diff --git a/index.ts b/index.ts index 9569354..5d5ee5e 100644 --- a/index.ts +++ b/index.ts @@ -448,11 +448,11 @@ export class PythonShell extends EventEmitter { /** * Sends a kill signal to the process - * @returns {PythonShell} The same instance for chaining calls + * @returns {boolean} Whether the kill signal was sent successfully */ kill(signal?: NodeJS.Signals) { this.terminated = this.childProcess.kill(signal); - return this; + return this.terminated; } /** diff --git a/test/test-python-shell.ts b/test/test-python-shell.ts index 3d5de81..d44442e 100644 --- a/test/test-python-shell.ts +++ b/test/test-python-shell.ts @@ -617,9 +617,9 @@ describe('PythonShell', function () { }); describe('.kill()', function () { - it('set terminated to correct value', function (done) { + it('return kill result and set terminated to correct value', function (done) { let pyshell = new PythonShell('infinite_loop.py'); - pyshell.kill(); + should(pyshell.kill()).be.true(); pyshell.terminated.should.be.true; done(); });