public static int executeCommandLine( Commandline cl, InputStream systemIn, StreamConsumer systemOut, StreamConsumer systemErr ) throws CommandLineException { return executeCommandLine( cl, systemIn, systemOut, systemErr, 0 ); }
public static int executeCommandLine( Commandline cl, StreamConsumer systemOut, StreamConsumer systemErr, int timeoutInSeconds ) throws CommandLineException { return executeCommandLine( cl, null, systemOut, systemErr, timeoutInSeconds ); }
returnCode = CommandLineUtils.executeCommandLine( cli, out, err );
result = CommandLineUtils.executeCommandLine( commandline, stdOut, stdErr ); if ( logger != null )
public void run() { try { CommandLineUtils.executeCommandLine(commandline, outConsumer, errConsumer); } catch (final Exception e) { setThrown(e); } } });
/** * Forks a JVM using the previously set parameters. * * @return The exit code of the forked JVM. * @throws Exception If the JVM could not be forked. */ public int run() throws Exception { return CommandLineUtils.executeCommandLine( createCommandLine(), this.systemOut, this.systemErr ); }
public static int execute( Commandline cl, CommandLineUtils.StringStreamConsumer stdout, CommandLineUtils.StringStreamConsumer stderr, ScmLogger logger ) throws CommandLineException { int exitCode = CommandLineUtils.executeCommandLine( cl, stdout, stderr ); exitCode = checkIfCleanUpIsNeeded( exitCode, cl, stdout, stderr, logger ); return exitCode; }
public static int execute( Commandline cl, CommandLineUtils.StringStreamConsumer stdout, CommandLineUtils.StringStreamConsumer stderr, ScmLogger logger ) throws CommandLineException { int exitCode = CommandLineUtils.executeCommandLine( cl, stdout, stderr ); exitCode = checkIfCleanUpIsNeeded( exitCode, cl, stdout, stderr, logger ); return exitCode; }
static int executeCmd( HgConsumer consumer, Commandline cmd ) throws ScmException { final int exitCode; try { exitCode = CommandLineUtils.executeCommandLine( cmd, consumer, consumer ); } catch ( CommandLineException ex ) { throw new ScmException( "Command could not be executed: " + cmd, ex ); } return exitCode; }
static int executeCmd( HgConsumer consumer, Commandline cmd ) throws ScmException { final int exitCode; try { exitCode = CommandLineUtils.executeCommandLine( cmd, consumer, consumer ); } catch ( CommandLineException ex ) { throw new ScmException( "Command could not be executed: " + cmd, ex ); } return exitCode; }
static int executeCmd( BazaarConsumer consumer, Commandline cmd ) throws ScmException { final int exitCode; try { exitCode = CommandLineUtils.executeCommandLine( cmd, consumer, consumer ); } catch ( CommandLineException ex ) { throw new ScmException( "Command could not be executed: " + cmd, ex ); } return exitCode; }
/** * Extracted so test class can override * * @param stdin * @param stdout * @param stderr * @return * @throws CommandLineException */ protected int executeCommandLine( Commandline cl, InputStream stdin, CommandOutputConsumer stdout, StreamConsumer stderr ) throws CommandLineException { int result = CommandLineUtils.executeCommandLine( cl, stdin, stdout, stderr ); stdout.waitComplete(); return result; }
public static int execute( Commandline cl, StreamConsumer consumer, CommandLineUtils.StringStreamConsumer stderr, ScmLogger logger ) throws CommandLineException { // SCM-482: force English resource bundle cl.addEnvironment( "LC_MESSAGES", "en" ); int exitCode = CommandLineUtils.executeCommandLine( cl, consumer, stderr ); exitCode = checkIfCleanUpIsNeeded( exitCode, cl, consumer, stderr, logger ); return exitCode; }
public static final int execute(Commandline cl) { try { StreamConsumer stdout = new org.kuali.common.util.stream.LoggingStreamConsumer(logger, org.kuali.common.util.log.LoggerLevel.INFO); StreamConsumer stderr = new org.kuali.common.util.stream.LoggingStreamConsumer(logger, org.kuali.common.util.log.LoggerLevel.WARN); logger.info(cl.toString()); return CommandLineUtils.executeCommandLine(cl, stdout, stderr); } catch (CommandLineException e) { throw new IllegalStateException(e); } }
public static int execute( Commandline cl, StreamConsumer consumer, CommandLineUtils.StringStreamConsumer stderr, ScmLogger logger ) throws CommandLineException { // SCM-482: force English resource bundle cl.addEnvironment( "LC_MESSAGES", "en" ); int exitCode = CommandLineUtils.executeCommandLine( cl, consumer, stderr ); exitCode = checkIfCleanUpIsNeeded( exitCode, cl, consumer, stderr, logger ); return exitCode; }
public static void executeCommand(Commandline commandline, StreamConsumer outConsumer, StreamConsumer errorConsumer, boolean isVerbose) throws CommandLineException { if (isVerbose) { System.out.println("Executing command:\n" + StringUtils.join(commandline.getShellCommandline(), " ")); } int returnCode = CommandLineUtils.executeCommandLine(commandline, outConsumer, errorConsumer, 1800); if (returnCode != 0) { String msg = "Failed to deploy, return code: " + returnCode + ". Please make sure target WAS is alive and reachable."; throw new WebSphereServiceException(msg); } else { System.out.println("Return code: " + returnCode); } }
protected int execute(ExecContext context, Commandline cl) { try { logger.debug("[{}]", cl); StreamConsumer stdout = getConsumer(context.getStandardOutConsumer(), logger, LoggerLevel.INFO); StreamConsumer stderr = getConsumer(context.getStandardErrConsumer(), logger, LoggerLevel.WARN); return CommandLineUtils.executeCommandLine(cl, context.getInput(), stdout, stderr, context.getTimeoutInSeconds()); } catch (CommandLineException e) { throw new IllegalStateException(e); } }
public static int executeCommandline( Commandline cl, StreamConsumer consumer, CommandLineUtils.StringStreamConsumer stderr, ScmLogger logger ) throws ScmException { if ( logger.isInfoEnabled() ) { logger.info( "Command line: " + displayCommandlineWithoutPassword( cl ) ); } try { return CommandLineUtils.executeCommandLine( cl, consumer, stderr ); } catch ( CommandLineException ex ) { throw new ScmException( "Error while executing command.", ex ); } }
private static int checkIfCleanUpIsNeeded( int exitCode, Commandline cl, StreamConsumer consumer, CommandLineUtils.StringStreamConsumer stderr, ScmLogger logger ) throws CommandLineException { if ( exitCode != 0 && stderr.getOutput() != null && stderr.getOutput().indexOf( "'svn cleanup'" ) > 0 && stderr.getOutput().indexOf( "'svn help cleanup'" ) > 0 ) { if ( logger.isInfoEnabled() ) { logger.info( "Svn command failed due to some locks in working copy. We try to run a 'svn cleanup'." ); } if ( executeCleanUp( cl.getWorkingDirectory(), consumer, stderr, logger ) == 0 ) { exitCode = CommandLineUtils.executeCommandLine( cl, consumer, stderr ); } } return exitCode; }
public static int executeCommandline( Commandline cl, StreamConsumer consumer, CommandLineUtils.StringStreamConsumer stderr, ScmLogger logger ) throws ScmException { if ( logger.isInfoEnabled() ) { logger.info( "Command line: " + displayCommandlineWithoutPassword( cl ) ); } try { return CommandLineUtils.executeCommandLine( cl, consumer, stderr ); } catch ( CommandLineException ex ) { throw new ScmException( "Error while executing command.", ex ); } }