Skip to content

Commit 136e6e7

Browse files
committed
add timeout mechanism to tryRun
1 parent 5450d47 commit 136e6e7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/core/src/shared/utilities/pathFind.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { GitExtension } from '../extensions/git'
1111
import { Settings } from '../settings'
1212
import { getLogger } from '../logger/logger'
1313
import { mergeResolvedShellPath } from '../env/resolveEnv'
14+
import { Timeout } from './timeoutUtils'
1415

1516
/** Full path to VSCode CLI. */
1617
let vscPath: string
@@ -32,9 +33,13 @@ export async function tryRun(
3233
p: string,
3334
args: string[],
3435
logging: 'yes' | 'no' | 'noresult' = 'yes',
36+
timeout?: Timeout,
3537
expected?: string,
3638
opt?: ChildProcessOptions
3739
): Promise<boolean> {
40+
timeout?.onCompletion(() => {
41+
throw new Error(`tryRun timed out: ${p} ${args.join(' ')}`)
42+
})
3843
const proc = new ChildProcess(p, args, { logging: 'no' })
3944
const r = await proc.run({
4045
...opt,

0 commit comments

Comments
 (0)