Skip to content

Commit e56f0ed

Browse files
authored
feat(cli-hooks): exit the start process with the subprocess exit code (#2153)
1 parent 9048fd9 commit e56f0ed

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

packages/cli-hooks/src/start.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default function start(cwd) {
3333
process.stderr.write(data);
3434
});
3535
app.on('close', (code) => {
36-
console.log(`Local run exited with code ${code}`);
36+
process.exit(code);
3737
});
3838
}
3939

packages/cli-hooks/src/start.spec.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import start from './start.js';
2323
describe('start implementation', async () => {
2424
describe('begins the app process', async () => {
2525
/** @type {sinon.SinonStub} */
26-
let consoleLogStub;
26+
let exitStub;
2727
/** @type {sinon.SinonStub} */
2828
let stdoutWriteStub;
2929
/** @type {sinon.SinonStub} */
@@ -34,7 +34,7 @@ describe('start implementation', async () => {
3434
let spawnStub;
3535

3636
beforeEach(() => {
37-
consoleLogStub = sinon.stub(console, 'log');
37+
exitStub = sinon.stub(process, 'exit');
3838
stdoutWriteStub = sinon.stub(process.stdout, 'write');
3939
stderrWriteStub = sinon.stub(process.stderr, 'write');
4040
mockSpawnProcess = {
@@ -84,7 +84,7 @@ describe('start implementation', async () => {
8484
assert.ok(spawnStub.calledWith('node', [path.resolve('tmp', 'start.js')]));
8585
assert.ok(stdoutWriteStub.calledWith('message'));
8686
assert.ok(stderrWriteStub.calledWith('warning'));
87-
assert.ok(consoleLogStub.calledWith('Local run exited with code 0'));
87+
assert.ok(exitStub.calledWith(0));
8888
});
8989
});
9090

@@ -99,7 +99,7 @@ describe('start implementation', async () => {
9999
assert.ok(spawnStub.calledWith('node', [path.resolve('tmp', 'app.js')]));
100100
assert.ok(stdoutWriteStub.calledWith('defaults'));
101101
assert.ok(stderrWriteStub.calledWith('watch out'));
102-
assert.ok(consoleLogStub.calledWith('Local run exited with code 2'));
102+
assert.ok(exitStub.calledWith(2));
103103
});
104104
});
105105

@@ -122,7 +122,7 @@ describe('start implementation', async () => {
122122
assert.ok(spawnStub.calledWith('node', [path.resolve('application.js')]));
123123
assert.ok(stdoutWriteStub.calledWith('startled'));
124124
assert.ok(stderrWriteStub.calledWith('erroneous'));
125-
assert.ok(consoleLogStub.calledWith('Local run exited with code 4'));
125+
assert.ok(exitStub.calledWith(4));
126126
});
127127
});
128128
});

0 commit comments

Comments
 (0)