File tree Expand file tree Collapse file tree 2 files changed +11
-15
lines changed Expand file tree Collapse file tree 2 files changed +11
-15
lines changed Original file line number Diff line number Diff line change @@ -9,22 +9,11 @@ const server = app.listen(null, () => {
99const agent = request . agent ( server ) ;
1010
1111const child = spawn ( "node" , [ "./misc/initDB" ] ) ;
12- child . stdout . on ( "data" , ( data ) => {
13- console . log ( `stdout: ${ data } ` ) ;
14- } ) ;
15- child . stderr . on ( "data" , ( data ) => {
16- console . log ( `stderr: ${ data } ` ) ;
17- } ) ;
18- child . stdout . on ( "error" , ( error ) => {
19- console . log ( `error: ${ error . message } ` ) ;
20- } ) ;
21- child . on ( "exit" , ( code , signal ) => {
22- if ( code ) console . log ( `Process exit with code: ${ code } ` ) ;
23- if ( signal ) console . log ( `Process killed with signal: ${ signal } ` ) ;
24- } ) ;
2512global . server = server ;
2613global . agent = agent ;
14+ global . child = child ;
2715export default async ( ) => {
2816 global . server = server ;
2917 global . agent = agent ;
18+ global . child = child ;
3019} ;
Original file line number Diff line number Diff line change 1+ const teardownProcess = ( ) => {
2+ global . child . kill ( ) ;
3+ } ;
4+
15global . server . close ( ) ;
26global . agent . app . close ( ) ;
3- export default async ( ) => {
4- } ;
7+ global . child . stdin . end ( ) ;
8+ global . child . stdout . destroy ( ) ;
9+ global . child . stderr . destroy ( ) ;
10+ setTimeout ( teardownProcess , 500 ) ;
11+ export default async ( ) => { } ;
You can’t perform that action at this time.
0 commit comments