File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change 1- var execFile = require ( "child_process" ) . execFile ;
1+ var spawn = require ( "child_process" ) . spawn ;
22
33exports . handler = function ( event , context ) {
4- child = execFile ( event . file , event . args , function ( error ) {
5- context . done ( error , "Process complete!" ) ;
4+ child = spawn ( event . file , event . args ) ;
5+
6+ child . stdout . on ( "data" , function ( data ) {
7+ console . log ( data . toString ( ) )
8+ } ) ;
9+ child . stderr . on ( "data" , function ( data ) {
10+ console . error ( data . toString ( ) )
11+ } ) ;
12+ child . on ( "close" , function ( code ) {
13+ if ( code == 0 ) {
14+ context . succeed ( "Process complete!" ) ;
15+ } else {
16+ context . fail ( "Process failed with exit code: " + code ) ;
17+ }
618 } ) ;
7- child . stdout . on ( "data" , console . log ) ;
8- child . stderr . on ( "data" , console . error ) ;
919} ;
You can’t perform that action at this time.
0 commit comments