File tree 2 files changed +30
-1
lines changed
2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env node
2
+ const { spawn } = require ( "child_process" ) ;
3
+ const { normalize } = require ( "path" ) ;
4
+
5
+ // 'disconnect' is not needed as it will only be raised, when either the child process or this process calss disconnect explicitly.
6
+ // We are abel to ensure, that this will never happen, as we do not need communication with the spawned subprocess
7
+ const terminationSignals = [ "close" , "exit" ] ;
8
+
9
+ function startSubprocess ( ) {
10
+ return new Promise ( ( res , rej ) => {
11
+ const [ command , ...args ] = process . argv . slice ( 2 ) ;
12
+ const proc = spawn ( normalize ( command ) , args , {
13
+ // use parents stdio
14
+ stdio : "inherit" ,
15
+ shell :
16
+ process . platform === "win32" ||
17
+ / ^ ( m s y s | c y g w i n ) $ / . test ( process . env . OSTYPE ) ,
18
+ } ) ;
19
+ terminationSignals . forEach ( ( event ) => proc . on ( event , res ) ) ;
20
+ proc . on ( "error" , rej ) ;
21
+ } ) ;
22
+ }
23
+
24
+ async function loop ( ) {
25
+ let code = 64 ;
26
+ while ( code === 64 ) code = await startSubprocess ( ) ;
27
+ }
28
+
29
+ loop ( ) ;
Original file line number Diff line number Diff line change 8
8
"scripts" : {
9
9
"build" : " webpack --mode production" ,
10
10
"dev" : " webpack --mode=development" ,
11
- "start" : " ./ livereload.sh node_modules/.bin/qode ./dist/index.js" ,
11
+ "start" : " node livereload.js node_modules/.bin/qode ./dist/index.js" ,
12
12
"debug" : " qode --inspect ./dist/index.js"
13
13
},
14
14
"dependencies" : {
You can’t perform that action at this time.
0 commit comments