File tree 1 file changed +15
-4
lines changed
1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,9 @@ var path = require('path'),
39
39
httpProxy = require ( '../../' ) ,
40
40
common = require ( './common' ) ;
41
41
42
- var test = process . argv [ 2 ] ;
42
+ var test = process . argv [ 2 ] ,
43
+ done = false ,
44
+ testProcess ;
43
45
44
46
if ( ! test ) {
45
47
return console . error ( 'Need test to run' ) ;
@@ -52,11 +54,20 @@ proxy.listen(common.PROXY_PORT);
52
54
53
55
proxy . on ( 'listening' , function ( ) {
54
56
console . log ( 'Proxy server listening on ' + common . PROXY_PORT ) ;
55
- var testProcess = spawn ( process . argv [ 0 ] , [ process . argv [ 2 ] ] ) ;
57
+ testProcess = spawn ( process . argv [ 0 ] , [ process . argv [ 2 ] ] ) ;
56
58
testProcess . stdout . pipe ( process . stdout ) ;
57
59
testProcess . stderr . pipe ( process . stderr ) ;
58
- testProcess . on ( 'exit' , process . exit ) ;
60
+
61
+ testProcess . on ( 'exit' , function ( ) {
62
+ done = true ;
63
+ process . exit ( ) ;
64
+ } ) ;
59
65
} ) ;
60
66
61
- // vim:filetype=javascript
67
+ process . on ( 'exit' , function ( ) {
68
+ if ( ! done ) {
69
+ textProcess . kill ( ) ;
70
+ }
71
+ } ) ;
62
72
73
+ // vim:filetype=javascript
You can’t perform that action at this time.
0 commit comments