Skip to content

Commit 14fad84

Browse files
committed
fix: let kill opt be a signal shortcut
1 parent 3fee15c commit 14fad84

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/main/ts/ps.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,15 @@ export const extractWmic = (stdout: string): string => {
112112
* @param next
113113
*/
114114
// eslint-disable-next-line sonarjs/cognitive-complexity
115-
export const kill = (pid: string | number, opts?: TPsNext | TPsKillOptions, next?: TPsNext ) => {
115+
export const kill = (pid: string | number, opts?: TPsNext | TPsKillOptions | TPsKillOptions['signal'], next?: TPsNext ) => {
116116
if (typeof opts == 'function') {
117117
kill(pid, undefined, opts)
118118
return
119119
}
120+
if (typeof opts == 'string' || typeof opts == 'number') {
121+
kill(pid, { signal: opts }, next)
122+
return
123+
}
120124
const {
121125
timeout = 30,
122126
signal = 'SIGTERM'
@@ -192,3 +196,5 @@ export const formatOutput = (data: TIngridResponse): TPsLookupEntry[] =>
192196

193197
return m
194198
}, [])
199+
200+
export default { lookup, kill }

0 commit comments

Comments
 (0)