public Object clone() { Commandline c = new Commandline( (Shell) shell.clone() ); c.executable = executable; c.workingDir = workingDir; c.addArguments( getArguments() ); return c; }
commandline.addArguments( commands.toArray( new String[ commands.size() ] ) ); if ( workingDirectory != null && workingDirectory.exists() )
private Commandline createCommandLine() { final Commandline commandline = new Commandline(); commandline.setExecutable(phantomjs); final ArrayList<String> arguments = new ArrayList<>(); arguments.add("--debug=" + String.valueOf(phantomjsDebug)); arguments.add("--web-security=" + String.valueOf(phantomjsWebSecurity)); arguments.add(testRunner); arguments.add(testPageUrl); arguments.add(testResultFilename); arguments.add(String.valueOf(phantomjsResourceTimeout)); commandline.addArguments(arguments.toArray(new String[arguments.size()])); return commandline; }
public static Commandline createCommandLine( GitScmProviderRepository repository, ScmFileSet fileSet ) { Commandline cl = GitCommandLineUtils.getBaseGitCommandLine( fileSet.getBasedir(), "status" ); cl.addArguments( new String[] { "--porcelain", "." } ); return cl; }
public static Commandline createRevparseShowPrefix( ScmFileSet fileSet ) { Commandline cl = GitCommandLineUtils.getBaseGitCommandLine( fileSet.getBasedir(), "rev-parse" ); cl.addArguments( new String[] { "--show-prefix" } ); return cl; } }
public static Commandline createCommandLine( GitScmProviderRepository repository, ScmFileSet fileSet ) { Commandline cl = GitCommandLineUtils.getBaseGitCommandLine( fileSet.getBasedir(), "status" ); cl.addArguments( new String[] { "--porcelain", "." } ); return cl; }
public static Commandline createRevparseShowPrefix( ScmFileSet fileSet ) { Commandline cl = GitCommandLineUtils.getBaseGitCommandLine( fileSet.getBasedir(), "rev-parse" ); cl.addArguments( new String[] { "--show-prefix" } ); return cl; } }
public static Commandline createCommandLine( GitScmProviderRepository repository, ScmFileSet fileSet ) { Commandline cl = GitCommandLineUtils.getBaseGitCommandLine( fileSet.getBasedir(), "status" ); cl.addArguments( new String[] { "--porcelain", "." } ); return cl; }
static Commandline buildCmd( File workingDir, String[] cmdAndArgs ) throws ScmException { Commandline cmd = new Commandline(); cmd.setExecutable( BazaarConstants.EXEC ); cmd.setWorkingDirectory( workingDir.getAbsolutePath() ); cmd.addArguments( cmdAndArgs ); if ( !workingDir.exists() ) { boolean success = workingDir.mkdirs(); if ( !success ) { String msg = "Working directory did not exist" + " and it couldn't be created: " + workingDir; throw new ScmException( msg ); } } return cmd; }
private static Commandline buildPythonCmd( File workingDir, String[] cmdAndArgs ) throws ScmException { Commandline cmd = new Commandline(); cmd.setExecutable( PYTHON_EXEC ); cmd.setWorkingDirectory( workingDir.getAbsolutePath() ); cmd.addArguments( cmdAndArgs ); if ( !workingDir.exists() ) { boolean success = workingDir.mkdirs(); if ( !success ) { String msg = "Working directory did not exist" + " and it couldn't be created: " + workingDir; throw new ScmException( msg ); } } return cmd; }
private void setCommandLineArgs( String[] args ) { cl.clearArgs(); if ( args.length > 0 ) { // First arg is the accurev command cl.createArg().setValue( args[0] ); // Inject -H <host:port> and -A <token> here cl.addArguments( hostArgs ); cl.addArguments( authArgs ); } for ( int i = 1; i < args.length; i++ ) { cl.createArg().setValue( args[i] ); } }
private Commandline getCommandLine() throws ExecutionException { Commandline commandline = new Commandline(this.phantomJsBinary); if (configFile != null && configFile.exists()) { commandline.createArg().setValue("--config=" + configFile.getAbsolutePath()); } else { commandline.addArguments(this.getCommandLineOptions(commandLineOptions)); } if (script != null) { commandline.createArg().setValue(script); } if (arguments != null) { commandline.addArguments(arguments.toArray(new String[arguments.size()])); } if (workingDirectory != null) { commandline.setWorkingDirectory(workingDirectory); } return commandline; }
private void setCommandLineArgs( String[] args ) { cl.clearArgs(); if ( args.length > 0 ) { // First arg is the accurev command cl.createArg().setValue( args[0] ); // Inject -H <host:port> and -A <token> here cl.addArguments( hostArgs ); cl.addArguments( authArgs ); } for ( int i = 1; i < args.length; i++ ) { cl.createArg().setValue( args[i] ); } }
static Commandline buildCmd( File workingDir, String[] cmdAndArgs ) throws ScmException { Commandline cmd = new Commandline(); cmd.setExecutable( HgCommandConstants.EXEC ); cmd.addArguments( cmdAndArgs ); if ( workingDir != null ) { cmd.setWorkingDirectory( workingDir.getAbsolutePath() ); if ( !workingDir.exists() ) { boolean success = workingDir.mkdirs(); if ( !success ) { String msg = "Working directory did not exist" + " and it couldn't be created: " + workingDir; throw new ScmException( msg ); } } } return cmd; }
/** * <pre> * ssh [args] [user@]hostname command * </pre> */ public static final int ssh(List<String> args, String user, String hostname, String command) { Assert.notNull(hostname); Assert.notNull(command); List<String> arguments = new ArrayList<String>(); arguments.addAll(CollectionUtils.toEmptyList(args)); if (!StringUtils.isBlank(user)) { arguments.add(user + "@" + hostname); } else { arguments.add(hostname); } arguments.add(command); Commandline cl = new Commandline(); cl.setExecutable(SSH); cl.addArguments(CollectionUtils.toStringArray(arguments)); return execute(cl); }
/** * <pre> * rsync [options] source destination * rsync [options] source [user@]hostname:destination * rsync [options] [user@]hostname:source destination * </pre> */ public static final int rsync(List<String> options, String source, String destination) { Assert.notNull(source); Assert.notNull(destination); List<String> arguments = new ArrayList<String>(); arguments.addAll(CollectionUtils.toEmptyList(options)); arguments.add(source); arguments.add(destination); Commandline cl = new Commandline(); cl.setExecutable(RSYNC); cl.addArguments(CollectionUtils.toStringArray(arguments)); return execute(cl); }
private Commandline getCommandLine(ExecRequest request) { Commandline cl = new Commandline(); if (request.getShell().isPresent()) { cl.getShell().setShellCommand(request.getShell().get()); } cl.setExecutable(request.getExecutable()); cl.addArguments(request.getArgs().toArray(EMPTY_STRING_ARRAY)); if (request.getWorkingDirectory().isPresent()) { cl.setWorkingDirectory(request.getWorkingDirectory().get()); } addSystemEnvironmentVariables(cl, request.isAddSystemEnvironmentVariables()); // Explicit environment variables "win" over system environment variables for (Map.Entry<String, String> pair : request.getEnvironmentVariables().entrySet()) { cl.addEnvironment(pair.getKey(), pair.getValue()); } return cl; }
/** * Invokes the {@code thrift} compiler using the configuration specified at * construction. * * @return The exit status of {@code thrift}. * @throws CommandLineException */ public int compile() throws CommandLineException { for (File thriftFile : thriftFiles) { Commandline cl = new Commandline(); cl.setExecutable(executable); cl.addArguments(buildThriftCommand(thriftFile).toArray(new String[]{})); final int result = CommandLineUtils.executeCommandLine(cl, null, output, error); if (result != 0) { return result; } } // result will always be 0 here. return 0; }
protected Commandline getCommandLine(ExecContext context) { Commandline cl = new Commandline(); cl.setExecutable(context.getExecutable()); if (context.isAddSystemEnvironment()) { try { cl.addSystemEnvironment(); } catch (Exception e) { throw new IllegalStateException(e); } } if (context.getArgs() != null) { cl.addArguments(CollectionUtils.toStringArray(context.getArgs())); } if (context.getWorkingDirectory() != null) { cl.setWorkingDirectory(context.getWorkingDirectory()); } return cl; }