Skip to content
Permalink
Browse files

fix(core): restart app in development via CLI multiple times (#904)

Fixes #903.
  • Loading branch information
miaowing authored and malept committed Jun 12, 2019
1 parent a91d8b3 commit df98fe813f27dc15f0b5812d1405454505de9b2b
Showing with 6 additions and 4 deletions.
  1. +6 −4 packages/api/core/src/api/start.ts
@@ -113,20 +113,22 @@ export default async ({
};

const forgeSpawnWrapper = async () => {
lastSpawned = await forgeSpawn();
const spawned = await forgeSpawn();
// When the child app is closed we should stop listening for stdin
if (lastSpawned) {
if (spawned) {
if (interactive && process.stdin.isPaused()) {
process.stdin.resume();
}
lastSpawned.on('exit', () => {
if ((lastSpawned as any).restarted) return;
spawned.on('exit', () => {
if ((spawned as any).restarted) return;

if (!process.stdin.isPaused()) process.stdin.pause();
});
} else if (interactive && !process.stdin.isPaused()) {
process.stdin.pause();
}

lastSpawned = spawned;
return lastSpawned;
};

0 comments on commit df98fe8

Please sign in to comment.
You can’t perform that action at this time.