@@ -13,6 +13,7 @@ import { DBTConfiguration } from "./configuration";
13
13
import path from "path" ;
14
14
import { parse } from "yaml" ;
15
15
import * as crypto from "crypto" ;
16
+ import { combineAbortSignals } from "../utils" ;
16
17
17
18
export const DBT_PROJECT_FILE = "dbt_project.yml" ;
18
19
export const MANIFEST_FILE = "manifest.json" ;
@@ -124,32 +125,7 @@ export class CLIDBTCommandExecutionStrategy
124
125
) ;
125
126
}
126
127
// Combine signals if multiple are provided
127
- let combinedSignal : AbortSignal | undefined ;
128
- const signals : AbortSignal [ ] = [ ] ;
129
- if ( signal !== undefined ) {
130
- signals . push ( signal ) ;
131
- }
132
- if ( command . signal !== undefined ) {
133
- signals . push ( command . signal ) ;
134
- }
135
-
136
- if ( signals . length > 0 ) {
137
- if ( signals . length === 1 ) {
138
- combinedSignal = signals [ 0 ] ;
139
- } else {
140
- // Create a combined signal if multiple signals are provided
141
- const controller = new AbortController ( ) ;
142
- combinedSignal = controller . signal ;
143
-
144
- signals . forEach ( ( s ) => {
145
- if ( s . aborted ) {
146
- controller . abort ( ) ;
147
- } else {
148
- s . addEventListener ( "abort" , ( ) => controller . abort ( ) ) ;
149
- }
150
- } ) ;
151
- }
152
- }
128
+ const combinedSignal = combineAbortSignals ( signal , command . signal ) ;
153
129
154
130
return this . commandProcessExecutionFactory . createCommandProcessExecution ( {
155
131
command : this . dbtPath ,
@@ -208,32 +184,7 @@ export class PythonDBTCommandExecutionStrategy
208
184
) ;
209
185
}
210
186
// Combine signals if multiple are provided
211
- let combinedSignal : AbortSignal | undefined ;
212
- const signals : AbortSignal [ ] = [ ] ;
213
- if ( signal !== undefined ) {
214
- signals . push ( signal ) ;
215
- }
216
- if ( command . signal !== undefined ) {
217
- signals . push ( command . signal ) ;
218
- }
219
-
220
- if ( signals . length > 0 ) {
221
- if ( signals . length === 1 ) {
222
- combinedSignal = signals [ 0 ] ;
223
- } else {
224
- // Create a combined signal if multiple signals are provided
225
- const controller = new AbortController ( ) ;
226
- combinedSignal = controller . signal ;
227
-
228
- signals . forEach ( ( s ) => {
229
- if ( s . aborted ) {
230
- controller . abort ( ) ;
231
- } else {
232
- s . addEventListener ( "abort" , ( ) => controller . abort ( ) ) ;
233
- }
234
- } ) ;
235
- }
236
- }
187
+ const combinedSignal = combineAbortSignals ( signal , command . signal ) ;
237
188
238
189
return this . commandProcessExecutionFactory . createCommandProcessExecution ( {
239
190
command : this . pythonEnvironment . pythonPath ,
0 commit comments