private FixedStringSearchInterpolator createEnvInterpolator() { PrefixedPropertiesValueSource envProps = new PrefixedPropertiesValueSource(Collections.singletonList("env."), CommandLineUtils.getSystemEnvVars(false), true ); return FixedStringSearchInterpolator.create( envProps ); } }
private void consumeLine( String line ) throws IOException { if ( consumer != null && !isDisabled() ) { consumer.consumeLine( line ); } } }
/** * Add system environment variables */ public void addSystemEnvironment() { Properties systemEnvVars = CommandLineUtils.getSystemEnvVars(); for ( Object o : systemEnvVars.keySet() ) { String key = (String) o; if ( !envVars.containsKey( key ) ) { addEnvironment( key, systemEnvVars.getProperty( key ) ); } } }
/** * 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. */ public Arg createArg() { return this.createArg( false ); }
public JVMStarter withJVM(String jvm) { commandline.setExecutable(jvm); return this; }
/** * @param cl The command line {@link Commandline} * @param systemOut {@link StreamConsumer} * @param systemErr {@link StreamConsumer} * @return return code. * @throws CommandLineException in case of a problem. */ public static int executeCommandLine( @Nonnull Commandline cl, StreamConsumer systemOut, StreamConsumer systemErr ) throws CommandLineException { return executeCommandLine( cl, null, systemOut, systemErr, 0 ); }
public JVMStarter withWorkingDirectory(File workingDirectory) { commandline.setWorkingDirectory(workingDirectory); return this; }
/** * @return the shell, executable and all defined arguments without masking any arguments. */ private String[] getShellCommandline() { return getShellCommandline( false ) ; }
/** * Create a new command line object. * Shell is autodetected from operating system */ public Commandline() { setDefaultShell(); }
/** * Returns all arguments defined by <code>addLine</code>, * <code>addValue</code> or the argument object. * @return an array of arguments. */ public String[] getArguments() { return getArguments( false ); }
public synchronized void waitUntilDone() throws InterruptedException { while ( !isDone() ) { wait(); } }
@Override public void consumeLine(String line) { super.consumeLine(line); if (!redirectTestOutputToFile) { System.out.println(line); } } }
/** {@inheritDoc} */ public String toString() { return StringUtils.join( getShellCommandline( true ), " " ); }