Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Jun 12, 2019
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions packages/api/core/src/api/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,21 +113,23 @@ 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();
}
return lastSpawned;

lastSpawned = spawned;
return spawned;
malept marked this conversation as resolved.
Show resolved Hide resolved
};

if (interactive) {
Expand Down