@ -26,7 +26,7 @@ exec(
console . log ( 'error!: ' + err . code ) ;
console . log ( 'error!: ' + err . code ) ;
console . log ( 'stdout: ' + JSON . stringify ( stdout ) ) ;
console . log ( 'stdout: ' + JSON . stringify ( stdout ) ) ;
console . log ( 'stderr: ' + JSON . stringify ( stderr ) ) ;
console . log ( 'stderr: ' + JSON . stringify ( stderr ) ) ;
assert . e qual( false , err . killed ) ;
assert . strictE qual( false , err . killed ) ;
} else {
} else {
success_count ++ ;
success_count ++ ;
console . dir ( stdout ) ;
console . dir ( stdout ) ;
@ -38,9 +38,10 @@ exec(
exec ( 'thisisnotavalidcommand' , function ( err , stdout , stderr ) {
exec ( 'thisisnotavalidcommand' , function ( err , stdout , stderr ) {
if ( err ) {
if ( err ) {
error_count ++ ;
error_count ++ ;
assert . equal ( '' , stdout ) ;
assert . strictEqual ( '' , stdout ) ;
assert . equal ( true , err . code != 0 ) ;
assert . strictEqual ( typeof err . code , 'number' ) ;
assert . equal ( false , err . killed ) ;
assert . notStrictEqual ( err . code , 0 ) ;
assert . strictEqual ( false , err . killed ) ;
assert . strictEqual ( null , err . signal ) ;
assert . strictEqual ( null , err . signal ) ;
console . log ( 'error code: ' + err . code ) ;
console . log ( 'error code: ' + err . code ) ;
console . log ( 'stdout: ' + JSON . stringify ( stdout ) ) ;
console . log ( 'stdout: ' + JSON . stringify ( stdout ) ) ;
@ -48,7 +49,8 @@ exec('thisisnotavalidcommand', function(err, stdout, stderr) {
} else {
} else {
success_count ++ ;
success_count ++ ;
console . dir ( stdout ) ;
console . dir ( stdout ) ;
assert . equal ( true , stdout != '' ) ;
assert . strictEqual ( typeof stdout , 'string' ) ;
assert . notStrictEqual ( stdout , '' ) ;
}
}
} ) ;
} ) ;
@ -60,7 +62,7 @@ exec(SLEEP3_COMMAND, { timeout: 50 }, function(err, stdout, stderr) {
assert . ok ( diff < 500 ) ;
assert . ok ( diff < 500 ) ;
assert . ok ( err ) ;
assert . ok ( err ) ;
assert . ok ( err . killed ) ;
assert . ok ( err . killed ) ;
assert . e qual( err . signal , 'SIGTERM' ) ;
assert . strictE qual( err . signal , 'SIGTERM' ) ;
} ) ;
} ) ;
@ -71,7 +73,7 @@ process.nextTick(function() {
console . log ( 'kill pid %d' , killMeTwice . pid ) ;
console . log ( 'kill pid %d' , killMeTwice . pid ) ;
// make sure there is no race condition in starting the process
// make sure there is no race condition in starting the process
// the PID SHOULD exist directly following the exec() call.
// the PID SHOULD exist directly following the exec() call.
assert . e qual( 'number' , typeof killMeTwice . _ handle . pid ) ;
assert . strictE qual( 'number' , typeof killMeTwice . _ handle . pid ) ;
// Kill the process
// Kill the process
killMeTwice . kill ( ) ;
killMeTwice . kill ( ) ;
} ) ;
} ) ;
@ -82,7 +84,7 @@ function killMeTwiceCallback(err, stdout, stderr) {
// works and that we are getting the proper callback parameters.
// works and that we are getting the proper callback parameters.
assert . ok ( err ) ;
assert . ok ( err ) ;
assert . ok ( err . killed ) ;
assert . ok ( err . killed ) ;
assert . e qual( err . signal , 'SIGTERM' ) ;
assert . strictE qual( err . signal , 'SIGTERM' ) ;
// the timeout should still be in effect
// the timeout should still be in effect
console . log ( '\'sleep 3\' was already killed. Took %d ms' , diff ) ;
console . log ( '\'sleep 3\' was already killed. Took %d ms' , diff ) ;
@ -98,6 +100,6 @@ exec('python -c "print 200000*\'C\'"', {maxBuffer: 1000},
process . on ( 'exit' , function ( ) {
process . on ( 'exit' , function ( ) {
assert . e qual( 1 , success_count ) ;
assert . strictE qual( 1 , success_count ) ;
assert . e qual( 1 , error_count ) ;
assert . strictE qual( 1 , error_count ) ;
} ) ;
} ) ;