File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed
packages/npm/@amazeelabs/publisher/src Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ export const run = (options: {
64
64
65
65
const result = new Promise < Result > ( ( resolve ) => {
66
66
process . on ( 'exit' , ( code ) : void => {
67
+ options . controller . offCancel ( kill ) ;
67
68
if ( killSignal ) {
68
69
core . output$ . next (
69
70
`Command killed with ${ killSignal } signal: "${ options . command } "` ,
@@ -109,7 +110,7 @@ export const run = (options: {
109
110
throw new Error ( `Failed to kill "${ options . command } " process.` ) ;
110
111
} ;
111
112
112
- options . controller ? .onCancel ( ( ) => kill ( ) ) ;
113
+ options . controller . onCancel ( kill ) ;
113
114
114
115
return {
115
116
output,
Original file line number Diff line number Diff line change @@ -6,6 +6,9 @@ export class TaskController {
6
6
onCancel = ( callback : ( ) => void ) : void => {
7
7
this . cancelCallbacks . push ( callback ) ;
8
8
} ;
9
+ offCancel = ( callback : ( ) => void ) : void => {
10
+ this . cancelCallbacks = this . cancelCallbacks . filter ( cb => cb !== callback ) ;
11
+ } ;
9
12
}
10
13
11
14
export type TaskResult = Promise < boolean > ;
You can’t perform that action at this time.
0 commit comments