Package org.apache.commons.exec

Examples of org.apache.commons.exec.CommandLine$Argument


public class ExecWorkItemHandler implements WorkItemHandler {

  public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
    String command = (String) workItem.getParameter("Command");
    CommandLine commandLine = CommandLine.parse(command);
    DefaultExecutor executor = new DefaultExecutor();
    try {
      executor.execute(commandLine);
      manager.completeWorkItem(workItem.getId(), null);
    } catch (Throwable t) {
View Full Code Here


    {
      // save file
      saveFile();


      CommandLine commandLine = CommandLine.parse(this.path + " " + this.args.getText());


      // set timeout
      ExecuteWatchdog watchdog = new ExecuteWatchdog(timeout);
View Full Code Here

 
 
  private boolean killSurvivor(final String pid) {
    final ByteArrayOutputStream err = new ByteArrayOutputStream();
    final ByteArrayOutputStream out = new ByteArrayOutputStream();
    final CommandLine cmdLine = new CommandLine(kill_cmd);
    cmdLine.addArguments(kill_cmd_params);
    cmdLine.addArguments(pid);
    final Executor executor = new DefaultExecutor();
    executor.setExitValue(1);
    final DefaultExecuteResultHandler derh = new DefaultExecuteResultHandler();
//    executor.setProcessDestroyer(MPlayerFileService.PROCESS_SHUTDOWN_HOOK);
    executor.setStreamHandler(new PumpStreamHandler(out, err));
View Full Code Here

 
  private List<ProcessToWatch> getProcessList() {
    final ByteArrayOutputStream err = new ByteArrayOutputStream();
    final ByteArrayOutputStream out = new ByteArrayOutputStream();
    final CommandLine cmdLine = new CommandLine(list_cmd);
    cmdLine.addArguments(list_cmd_params);
    final Executor executor = new DefaultExecutor();
    executor.setExitValue(1);

    final DefaultExecuteResultHandler derh = new DefaultExecuteResultHandler();
    executor.setProcessDestroyer(MPlayerFileService.PROCESS_SHUTDOWN_HOOK);
View Full Code Here

  public MPlayerThumbnailGeneratorProcess execute() throws ExecuteException, IOException {
    debug();
    prepare();
//    if (! path.toLowerCase().endsWith("mts")) {
      final CommandLine cmdLine = new CommandLine(this.mplayer);
      cmdLine.addArguments(this.arguments);
      cmdLine.addArgument(this.path, false);
//      ExecuteWatchdog watchdog = new ExecuteWatchdog(30*1000);
      final Executor executor = new DefaultExecutor();
      executor.setExitValue(1);
//      executor.setWatchdog(watchdog);
//      executor.setProcessDestroyer(MPlayerFileService.PROCESS_SHUTDOWN_HOOK);
View Full Code Here

  }

  public MPlayerMetaInfoReaderProcess execute() throws ExecuteException, IOException {
    prepare();
//    if (! path.toLowerCase().endsWith("mts")) {
      final CommandLine cmdLine = new CommandLine(this.mplayer);
      cmdLine.addArguments(this.arguments);
      cmdLine.addArgument(this.path, false);
//      ExecuteWatchdog watchdog = new ExecuteWatchdog(5*1000);
      final Executor executor = new DefaultExecutor();
      executor.setExitValue(1);
//      executor.setWatchdog(watchdog);
//      executor.setProcessDestroyer(MPlayerFileService.PROCESS_SHUTDOWN_HOOK);
View Full Code Here

    /**
     * Launches the given command in a new process.
     */
    public Process exec(final CommandLine cmd, final Map env)
            throws IOException {
        CommandLine vmsCmd = new CommandLine(
                createCommandFile(cmd, env).getPath()
        );

        return super.exec(vmsCmd, env);
    }
View Full Code Here

     * only works if <code>workingDir</code> is null or the logical
     * JAVA$FORK_SUPPORT_CHDIR needs to be set to TRUE.
     */
    public Process exec(final CommandLine cmd, final Map env,
            final File workingDir) throws IOException {
        CommandLine vmsCmd = new CommandLine(
                createCommandFile(cmd, env).getPath()
        );

        return super.exec(vmsCmd, env, workingDir);
    }
View Full Code Here

            final File workingDir) throws IOException {
        if (workingDir == null) {
            return exec(cmd, env);
        }

        CommandLine newCmd = new CommandLine("cmd");
        newCmd.addArgument("/c");
        newCmd.addArguments(cmd.toStrings());

        return exec(newCmd, env);
    }
View Full Code Here

     * variables.
     *
     * @return the command line
     */   
    protected CommandLine getProcEnvCommand() {
        CommandLine commandLine = new CommandLine("show");
        commandLine.addArgument("logical");
        return commandLine;
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.exec.CommandLine$Argument

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.