mirror of
https://github.com/toddbluhm/env-cmd.git
synced 2025-12-08 18:23:33 +00:00
Merge pull request #346 from berkes/fix/ts-return-void
fix: returning "true" instead of "void"
This commit is contained in:
commit
d91335a790
@ -89,10 +89,12 @@ export class TermSignals {
|
|||||||
*/
|
*/
|
||||||
public _terminateProcess (code?: number, signal?: NodeJS.Signals): void {
|
public _terminateProcess (code?: number, signal?: NodeJS.Signals): void {
|
||||||
if (signal !== undefined) {
|
if (signal !== undefined) {
|
||||||
return process.kill(process.pid, signal)
|
process.kill(process.pid, signal)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
if (code !== undefined) {
|
if (code !== undefined) {
|
||||||
return process.exit(code)
|
process.exit(code)
|
||||||
|
return // eslint-disable-line no-unreachable
|
||||||
}
|
}
|
||||||
throw new Error('Unable to terminate parent process successfully')
|
throw new Error('Unable to terminate parent process successfully')
|
||||||
}
|
}
|
||||||
|
|||||||
@ -71,6 +71,7 @@ describe('signal-termination', (): void => {
|
|||||||
|
|
||||||
it('should call exit method on parent process if no signal provided', (): void => {
|
it('should call exit method on parent process if no signal provided', (): void => {
|
||||||
term._terminateProcess(0)
|
term._terminateProcess(0)
|
||||||
|
// We here test code that in reality is unreachable.
|
||||||
assert.equal(exitStub.callCount, 1)
|
assert.equal(exitStub.callCount, 1)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user