Skip to content

Commit

Permalink
Cleanup and bump BE to 3.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bdw429s committed Mar 10, 2017
1 parent df5f0f7 commit de74aba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 68 deletions.
2 changes: 1 addition & 1 deletion build/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ External Dependencies:
<property name="distro.groupID" value="ortussolutions" />
<property name="distro.name" value="commandbox"/>
<!-- Special things happen when the version and stableVersion are the same value as that signifies a "stable" build. -->
<property name="commandbox.version" value="3.5.1-snapshot"/>
<property name="commandbox.version" value="3.6.0-snapshot"/>
<property name="commandbox.stableVersion" value="3.5.0"/>

<!-- Time Label -->
Expand Down
74 changes: 7 additions & 67 deletions src/cfml/system/modules_app/system-commands/commands/run.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -63,76 +63,16 @@ component{
var CWDFile = createObject( 'java', 'java.io.File' ).init( fileSystemUtil.resolvePath( '' ) );
var exitCode = createObject( "java", "java.lang.ProcessBuilder" )
.init( commandArray )
// Assume CommandBox's standard input for this process
//.redirectInput( redirect.INHERIT )
// Combine standard error and standard out
//.redirectErrorStream( true )
.inheritIO()
// Do you believe in magic
// This works great on Mac/Windows.
// On Linux, the standard input (keyboard) is not being piped to the background process.
.inheritIO()
// Sets current working directory for the process
.directory( CWDFile )
// Fires process async
.start()
// waits for it to exit, returning the exit code
.waitFor();

// This works great on Windows.
// On Linux, the standard input (keyboard) is not being piped to the background process.

// needs to be unique in each run to avoid errors
var threadName = '#createUUID()#';

/**
* // Spin up a thread to capture the standard out and error from the server
thread name="#threadName#" {
try{
var inputStream = process.getInputStream();
var inputStreamReader = createObject( 'java', 'java.io.InputStreamReader' ).init( inputStream );
var bufferedReader = createObject( 'java', 'java.io.BufferedReader' ).init( inputStreamReader );
// These two patterns need to be stripped off the output.
var exit = 'foo';
var jobControl = 'bash: no job control in this shell';
var char = bufferedReader.read();
var token = '';
while( char != -1 ){
token &= chr( char );
// Only output if we arent matching any of the forbidden patterns above.
if( !exit.startsWith( trim( token ) )
&& !jobControl.startsWith( trim( token ) )
&& !char == 13
&& !char == 10 ) {
// Build up our output
print
.text( token )
.toConsole();
token = '';
}
char = bufferedReader.read();
} // End of inputStream
// Output any trailing text as long as it isn't a match
if( !trim( token ).startsWith( exit )
&& !trim( token ).startsWith( jobControl ) ) {
print
.text( trim( token ) )
.toConsole();
}
} catch( any e ) {
logger.error( e.message & ' ' & e.detail, e.stacktrace );
print.line( e.message & ' ' & e.detail, e.stacktrace );
} finally {
// Make sure we always close the file or the process will never quit!
if( isDefined( 'bufferedReader' ) ) {
bufferedReader.close();
}
}
}
var exitCode = process.waitFor();
//thread action="join" name="#threadName#";
*/

if( exitCode != 0 ) {
error( 'Command returned failing exit code [#exitCode#]' );
Expand Down

0 comments on commit de74aba

Please sign in to comment.