From 24f07bf2c358485f03786cdf89706708380303ae Mon Sep 17 00:00:00 2001 From: Dang Pham Date: Fri, 14 Aug 2026 15:53:37 +0700 Subject: [PATCH 1/2] fix: return kill result --- index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; } /** From b4fd48c4803df3580f82cf89004b8627790de32c Mon Sep 17 00:00:00 2001 From: Dang Pham Date: Fri, 14 Aug 2026 15:54:24 +0700 Subject: [PATCH 2/2] test: cover kill return value --- test/test-python-shell.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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(); });