Package org.apache.commons.exec

Examples of org.apache.commons.exec.CommandLine


            return;
        }

        String line = getPlay2().getAbsolutePath();

        CommandLine cmdLine = CommandLine.parse(line);
        cmdLine.addArguments(getPlay2SystemPropertiesArguments(), false);
        cmdLine.addArgument("test");
        DefaultExecutor executor = new DefaultExecutor();

        if (timeout > 0) {
            ExecuteWatchdog watchdog = new ExecuteWatchdog(timeout);
            executor.setWatchdog(watchdog);
View Full Code Here


    public void execute()
            throws MojoExecutionException {

        String line = getPlay2().getAbsolutePath();

        CommandLine cmdLine = CommandLine.parse(line);
        cmdLine.addArgument("clean");
        DefaultExecutor executor = new DefaultExecutor();

        if (timeout > 0) {
            ExecuteWatchdog watchdog = new ExecuteWatchdog(timeout);
            executor.setWatchdog(watchdog);
View Full Code Here

                    throw new MojoExecutionException( "Could not make working directory: '"
                        + workingDirectory.getAbsolutePath() + "'" );
                }
            }

            CommandLine commandLine = getExecutablePath( enviro, workingDirectory );

            Executor exec = new DefaultExecutor();

            String[] args = new String[commandArguments.size()];
            for ( int i = 0; i < commandArguments.size(); i++ )
            {
                args[i] = (String) commandArguments.get( i );
            }

            commandLine.addArguments( args, false );

            exec.setWorkingDirectory( workingDirectory );

            fillSuccessCodes(exec);
           
View Full Code Here

        if ( exec == null )
        {
            exec = executable;
        }

        CommandLine toRet;
        if ( OS.isFamilyWindows() && exec.toLowerCase( Locale.getDefault() ).endsWith( ".bat" ) )
        {
            toRet = new CommandLine( "cmd" );
            toRet.addArgument( "/c" );
            toRet.addArgument( exec );
        }
        else
        {
            toRet = new CommandLine( exec );
        }

        return toRet;
    }
View Full Code Here

    }

    private int executeSyncCommand(String command, String[] args, Map<Object, Object> newEnv, int timeout)
            throws MuleControllerException
    {
        CommandLine commandLine = new CommandLine(muleBin);
        commandLine.addArgument(command);
        commandLine.addArguments(args);
        DefaultExecutor executor = new DefaultExecutor();
        ExecuteWatchdog watchdog = new ExecuteWatchdog(timeout);
        executor.setWatchdog(watchdog);
        executor.setStreamHandler(new PumpStreamHandler());
        return doExecution(executor, commandLine, newEnv);
View Full Code Here

        ExecuteWatchdog watchdog = new ExecuteWatchdog(timeout);
        executor.setWatchdog(watchdog);
        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        PumpStreamHandler streamHandler = new PumpStreamHandler(outputStream);
        executor.setStreamHandler(streamHandler);
        if (this.doExecution(executor, new CommandLine(this.muleBin).addArgument("status"), newEnv) == 0)
        {
            Matcher matcher = STATUS_PATTERN.matcher(outputStream.toString());
            if (matcher.find())
            {
                return Integer.parseInt(matcher.group(1));
View Full Code Here

        executeCommand(populateM2repoCommand + " " + repo, "MULE_HOME=" + muleHome);
    }

    public static int executeCommand(String command, String... envVars) throws IOException
    {
        CommandLine cmdLine = CommandLine.parse(command);
        DefaultExecutor executor = new DefaultExecutor();
        Map<String, String> env = addEnvProperties(envVars);
        ExecuteWatchdog watchDog = new ExecuteWatchdog(TIMEOUT);
        executor.setWatchdog(watchDog);
        executor.setStreamHandler(new PumpStreamHandler());
View Full Code Here

  public boolean isAvailable() {
    return php != null;
  }

  public CommandLine getCommand() {
    CommandLine cmd = new CommandLine(php.trim());
    cmd.addArgument(phar.trim());
   
    return cmd;
  }
View Full Code Here

                  }
                }
            }));
        }

        CommandLine cl = new CommandLine(cmd.get(0));
        for (int i = 1; i < cmd.size(); i++) {
            cl.addArgument(cmd.get(i), false);
        }
        try {
            int exitValue = exec.execute(cl);
            if (exitValue != 0) {
                if (throwFailure) {
View Full Code Here

    void executeCommand(String command) throws MojoExecutionException {
        try {
            if (isWindows()) {
                command = "cmd /c " + command;
            }
            CommandLine cmdLine = CommandLine.parse(command);
            DefaultExecutor executor = new DefaultExecutor();
            executor.setWorkingDirectory(yeomanProjectDirectory);
            executor.execute(cmdLine);
        } catch (IOException e) {
            throw new MojoExecutionException("Error during : " + command, e);
View Full Code Here

TOP

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

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.