Skip to content

Commit

Permalink
feat: kill method return result
Browse files Browse the repository at this point in the history
  • Loading branch information
gucheen committed Apr 24, 2024
1 parent fad1994 commit e3bcff0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ export abstract class Process extends events.EventEmitter {

public kill(signal?: NodeJS.Signals | number) {
if (this.process) {
this.process.kill(signal)
const result = this.process.kill(signal)
this.removeAllListeners()
return result
}
}

Expand Down
3 changes: 2 additions & 1 deletion test/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ describe('Traceroute', () => {
tracer.trace('github.com');

setTimeout(() => {
tracer.kill()
const killResult = tracer.kill()
expect(tracer.process?.killed).toBeTruthy()
expect(killResult).toBeTruthy()
done()
}, 5000)
}, 10000);
Expand Down

0 comments on commit e3bcff0

Please sign in to comment.