Commandline cli = new Commandline(); cli.setExecutable( executable );
Commandline commandLine = new Commandline(); commandLine.setExecutable(executable.getAbsolutePath()); Collection<String> args = getArguments(); for (String arg : args) { Arg _arg = commandLine.createArg(); _arg.setValue(arg); } WriterStreamConsumer systemOut = new WriterStreamConsumer(console); WriterStreamConsumer systemErr = new WriterStreamConsumer(console); returnCode = CommandLineUtils.executeCommandLine(commandLine, systemOut, systemErr, 10); if (returnCode != 0) { // bad } else { // good }
public static Commandline createStarteamBaseCommandLine( String action, StarteamScmProviderRepository repo ) { Commandline cl = new Commandline(); cl.createArg().setValue( "stcmd" ); cl.createArg().setValue( action ); cl.createArg().setValue( "-x" ); cl.createArg().setValue( "-nologo" ); cl.createArg().setValue( "-stop" ); return cl; }
Commandline cl = new Commandline(); cl.setExecutable( COMMAND_CLASS ); cl.createArg().setValue( TASK_CLASS ); CommandLineBuilder builder = new CommandLineBuilder( "macker" ); for ( Iterator/*<String>*/it = options.iterator(); it.hasNext(); ) { builder.addArg( (String) it.next() ); } builder.saveArgs(); String commandsFile = builder.getCommandLineFile(); cl.createArg().setValue( commandsFile ); StringStreamConsumer stdout = new StringStreamConsumer(); StringStreamConsumer stderr = new StringStreamConsumer(); int exitCode = CommandLineUtils.executeCommandLine( cl, stdout, stderr );
protected void executable( File file ) throws CommandLineException, IOException { if ( Os.isFamily( "unix" ) ) { Commandline cli = new Commandline(); cli.setExecutable( "chmod" ); cli.createArgument().setValue( "+x" ); cli.createArgument().setValue( file.getAbsolutePath() ); cli.execute(); } }
protected Commandline createUpdateConfigSpecCommandLine( File workingDirectory, File configSpecLocation, String viewName ) { Commandline command = new Commandline(); command.setWorkingDirectory( workingDirectory.getAbsolutePath() ); command.setExecutable( "cleartool" ); command.createArg().setValue( "setcs" ); command.createArg().setValue( "-tag" ); command.createArg().setValue( viewName ); command.createArg().setValue( configSpecLocation.getAbsolutePath() ); return command; }
commandline = new Commandline(); if ( customShell != null ) commandline.setExecutable( executable );
public static Commandline createStarteamBaseCommandLine( String action, StarteamScmProviderRepository repo ) { Commandline cl = new Commandline(); cl.createArg().setValue( "stcmd" ); cl.createArg().setValue( action ); cl.createArg().setValue( "-x" ); cl.createArg().setValue( "-nologo" ); cl.createArg().setValue( "-stop" ); return cl; }
Commandline cl = new Commandline(); cl.setExecutable( "dir" ); cl.setWorkingDirectory( workingDirectory.getAbsolutePath() ); cl.createArg().setValue( "/S" ); StreamConsumer consumer = new StreamConsumer() { public void consumeLine( String line ) { //do something with the line } }; StreamConsumer stderr = new StreamConsumer() { public void consumeLine( String line ) { //do something with the line } }; int exitCode; try { exitCode = CommandLineUtils.execute( cl, consumer, stderr, getLogger() ); } catch ( CommandLineException ex ) { //handle exception }
public Commandline createCommandLine( ScmFileSet fileSet ) throws ScmException { Commandline cl = new Commandline(); cl.setExecutable( "cvs" ); cl.setWorkingDirectory( fileSet.getBasedir().getAbsolutePath() ); cl.createArgument().setValue( "-f" ); // don't use ~/.cvsrc cl.createArgument().setValue( "-n" ); cl.createArgument().setValue( "-q" ); cl.createArgument().setValue( "update" ); cl.createArgument().setValue( "-d" ); return cl; } }
public static Commandline createCommandLine( File workingDirectory, String filename ) { Commandline command = new Commandline(); command.setWorkingDirectory( workingDirectory ); command.setExecutable( "tfpt" ); command.createArg().setValue( "annotate" ); command.createArg().setValue( "/noprompt" ); command.createArg().setValue( filename ); return command; } }
private Commandline createCommandLine() { final Commandline commandline = new Commandline(); commandline.setExecutable(phantomjs); return commandline; }
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; }
protected Commandline createUpdateConfigSpecCommandLine( File workingDirectory, File configSpecLocation, String viewName ) { Commandline command = new Commandline(); command.setWorkingDirectory( workingDirectory.getAbsolutePath() ); command.setExecutable( "cleartool" ); command.createArg().setValue( "setcs" ); command.createArg().setValue( "-tag" ); command.createArg().setValue( viewName ); command.createArg().setValue( configSpecLocation.getAbsolutePath() ); return command; }
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; }
protected Commandline createLinkerCommandLine( List objectFiles, LinkerConfiguration config ) throws NativeBuildException { Commandline cl = new Commandline(); cl.setWorkingDirectory( config.getWorkingDirectory().getPath() ); String executable = EXECUTABLE; if ( config.getExecutable() != null && config.getExecutable().trim().length() != 0 ) { executable = config.getExecutable(); } cl.createArg().setValue( executable ); cl.createArg().setValue( "\"" + config.getOutputFile() + "\"" ); for ( int i = 0; i < config.getStartOptions().length; ++i ) { cl.createArg().setValue( config.getStartOptions()[i] ); } for ( int i = 0; i < objectFiles.size(); ++i ) { File objFile = (File) objectFiles.get( i ); cl.createArg().setValue( "+\"" + objFile.getPath() + "\"" ); } return cl; }
public static Commandline createCommandLine( File workingDirectory, String filename ) { Commandline command = new Commandline(); command.setWorkingDirectory( workingDirectory ); command.setExecutable( "tfpt" ); command.createArg().setValue( "annotate" ); command.createArg().setValue( "/noprompt" ); command.createArg().setValue( filename ); return command; } }
@Override public Commandline createCommandLine( String executable ) throws MavenExecutorException { Commandline commandline = new Commandline(); commandline.setExecutable( executable ); try { commandline.addSystemEnvironment(); } catch ( Exception e ) { throw new MavenExecutorException( e.getMessage(), e ); } return commandline; } }
public static Commandline createCheckinCurrentDirCommandLine( ScmFileSet scmFileSet ) { Commandline command = new Commandline(); File workingDirectory = scmFileSet.getBasedir(); command.setWorkingDirectory( workingDirectory.getAbsolutePath() ); command.setExecutable( "cleartool" ); command.createArg().setValue( "ci" ); command.createArg().setValue( "-nc" ); command.createArg().setValue( "." ); return command; }
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; }