-
-
Notifications
You must be signed in to change notification settings - Fork 942
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
107 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import cp from 'child_process'; | ||
import readline from 'linebyline'; | ||
|
||
function spawn(name, cmd, args, done) { | ||
const spawnOptions = { | ||
detached: true, | ||
}; | ||
const proc = cp.spawn(cmd, args, spawnOptions); | ||
|
||
// We close stdin stream on the new process because otherwise the start-app | ||
// process hangs. | ||
// See https://github.com/wasp-lang/wasp/pull/1218#issuecomment-1599098272. | ||
proc.stdin.destroy(); | ||
|
||
readline(proc.stdout).on('line', (data) => { | ||
console.log(`\x1b[0m\x1b[33m[${name}][out]\x1b[0m ${data}`); | ||
}); | ||
readline(proc.stderr).on('line', (data) => { | ||
console.log(`\x1b[0m\x1b[33m[${name}][err]\x1b[0m ${data}`); | ||
}); | ||
proc.on('exit', done); | ||
} | ||
|
||
// Exit if either child fails | ||
const cb = (code) => { | ||
if (code !== 0) { | ||
process.exit(code); | ||
} | ||
}; | ||
spawn('app', 'npm', ['run', 'example-app:start-app'], cb); | ||
spawn('db', 'npm', ['run', 'example-app:start-db'], cb); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters