Skip to content
Permalink
Browse files

fix(core): stop specs hanging due to pending process.stdin listener

  • Loading branch information
MarshallOfSound committed May 14, 2018
1 parent 987161e commit b747c99b1d9411554f14bfdd476d82e233ea1df3
Showing with 16 additions and 8 deletions.
  1. +10 −8 packages/api/core/src/api/start.ts
  2. +6 −0 packages/api/core/test/fast/start_spec.ts
@@ -106,14 +106,16 @@ export default async ({
return spawned;
};

process.stdin.on('data', (data) => {
if (data.toString().trim() === 'rs' && lastSpawned) {
console.info('\nRestarting App\n'.cyan);
(lastSpawned as any).restarted = true;
lastSpawned.kill('SIGTERM');
forgeSpawnWrapper();
}
});
if (interactive) {
process.stdin.on('data', (data) => {
if (data.toString().trim() === 'rs' && lastSpawned) {
console.info('\nRestarting App\n'.cyan);
(lastSpawned as any).restarted = true;
lastSpawned.kill('SIGTERM');
forgeSpawnWrapper();
}
});
}

return forgeSpawnWrapper();
};
@@ -12,6 +12,7 @@ describe('start', () => {
let resolveStub: SinonStub;
let spawnStub: SinonStub;
let shouldOverride: boolean;
let processOn: SinonStub;

beforeEach(() => {
resolveStub = sinon.stub();
@@ -34,6 +35,11 @@ describe('start', () => {
spawn: spawnStub,
},
}).default;
processOn = sinon.stub(process.stdin, 'on');
});

afterEach(() => {
processOn.restore();
});

it('should spawn electron in the correct dir', async () => {

0 comments on commit b747c99

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