| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 78d4d91 commit b98cc51
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -368,6 +368,12 @@ function execFile(file /* , args, options, callback */) { | |||
| 368 | 368 | } | |
| 369 | 369 | } | |
| 370 | 370 | ||
| 371 | + function abortHandler() { | ||
| 372 | + if (!ex) | ||
| 373 | + ex = new AbortError(); | ||
| 374 | + process.nextTick(() => kill()); | ||
| 375 | + } | ||
| 376 | + | ||
| 371 | 377 | if (options.timeout > 0) { | |
| 372 | 378 | timeoutId = setTimeout(function delayedKill() { | |
| 373 | 379 | kill(); | |
@@ -376,16 +382,11 @@ function execFile(file /* , args, options, callback */) { | |||
| 376 | 382 | } | |
| 377 | 383 | if (options.signal) { | |
| 378 | 384 | if (options.signal.aborted) { | |
| 379 | - if (!ex) | ||
| 380 | - ex = new AbortError(); | ||
| 381 | - process.nextTick(() => kill()); | ||
| 385 | + process.nextTick(abortHandler); | ||
| 382 | 386 | } else { | |
| 383 | 387 | const childController = new AbortController(); | |
| 384 | - options.signal.addEventListener('abort', () => { | ||
| 385 | - if (!ex) | ||
| 386 | - ex = new AbortError(); | ||
| 387 | - kill(); | ||
| 388 | - }, { signal: childController.signal }); | ||
| 388 | + options.signal.addEventListener('abort', abortHandler, | ||
| 389 | + { signal: childController.signal }); | ||
| 389 | 390 | child.once('close', () => childController.abort()); | |
| 390 | 391 | } | |
| 391 | 392 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments