public void addArguments( String[] line ) { for ( String aLine : line ) { createArgument().setValue( aLine ); } }
public static int executeCommandLine( Commandline cl, InputStream systemIn, StreamConsumer systemOut, StreamConsumer systemErr ) throws CommandLineException { return executeCommandLine( cl, systemIn, systemOut, systemErr, 0 ); }
/** * Create a new command line object. */ public Commandline() { setDefaultShell(); }
public Object clone() { Commandline c = new Commandline( (Shell) shell.clone() ); c.executable = executable; c.workingDir = workingDir; c.addArguments( getArguments() ); return c; }
/** * <p>Creates an argument object.</p> * * <p>Each commandline object has at most one instance of the argument class. This method calls * <code>this.createArgument(false)</code>.</p> * * @return the argument object. * @see #createArgument(boolean) */ public Arg createArg() { return this.createArg( false ); }
public Properties getSystemEnvVars() throws Exception { return CommandLineUtils.getSystemEnvVars(); }
/** * @deprecated Use {@link CommandLineUtils#translateCommandline(String)} instead. */ public static String[] translateCommandline( String toProcess ) throws Exception { return CommandLineUtils.translateCommandline( toProcess ); }
public int size() { return getCommandline().length; }
private static void handleException( final StreamFeeder streamFeeder, final String streamName ) throws CommandLineException { if ( streamFeeder.getException() != null ) { throw new CommandLineException( String.format( "Failure processing %s.", streamName ), streamFeeder.getException() ); } }
private static void handleException( final StreamPumper streamPumper, final String streamName ) throws CommandLineException { if ( streamPumper.getException() != null ) { throw new CommandLineException( String.format( "Failure processing %s.", streamName ), streamPumper.getException() ); } }
/** * @deprecated Use {@link CommandLineUtils#toString(String[])} instead. */ public static String toString( String[] line ) { return CommandLineUtils.toString( line ); }
/** * <p>Creates an argument object.</p> * * <p>Each commandline object has at most one instance of the argument class. This method calls * <code>this.createArgument(false)</code>.</p> * * @return the argument object. * @see #createArgument(boolean) * @deprecated Use {@link Commandline#createArg()} instead */ public Argument createArgument() { return this.createArgument( false ); }
public String toString() { return StringUtils.join( getShellCommandline(), " " ); }
/** * @param cl The command line to execute * @param systemIn The input to read from, must be thread safe * @param systemOut A consumer that receives output, must be thread safe * @param systemErr A consumer that receives system error stream output, must be thread safe * @param timeoutInSeconds Positive integer to specify timeout, zero and negative integers for no timeout. * @return A return value, see {@link Process#exitValue()} * @throws CommandLineException or CommandLineTimeOutException if time out occurs */ public static int executeCommandLine( Commandline cl, InputStream systemIn, StreamConsumer systemOut, StreamConsumer systemErr, int timeoutInSeconds ) throws CommandLineException { final CommandLineCallable future = executeCommandLineAsCallable( cl, systemIn, systemOut, systemErr, timeoutInSeconds ); return future.call(); }
public String nextToken() { String token = internalNextToken(); if ( creturnDelims ) { return token; } if ( isDelim( token ) ) { return hasMoreTokens() ? internalNextToken() : ""; } else { return token; } }
/** * Adds an argument object to our list of args. * * @see #addArg(Arg,boolean) */ public void addArg( Arg argument ) { this.addArg( argument, false ); }
/** * @deprecated Use {@link CommandLineUtils#quote(String)} instead. */ public static String quoteArgument( String argument ) throws CommandLineException { return CommandLineUtils.quote( argument ); }
/** * <p>Return a marker.</p> * * <p>This marker can be used to locate a position on the commandline - to insert something for example - when all * parameters have been set. * </p> */ public Marker createMarker() { return new Marker( arguments.size() ); }
public synchronized void waitUntilDone() throws InterruptedException { while ( !isDone() ) { wait(); } }
public static int executeCommandLine( Commandline cl, StreamConsumer systemOut, StreamConsumer systemErr, int timeoutInSeconds ) throws CommandLineException { return executeCommandLine( cl, null, systemOut, systemErr, timeoutInSeconds ); }