Skip to content

Commit

Permalink
add timeout to child process
Browse files Browse the repository at this point in the history
  • Loading branch information
Hweinstock committed Nov 7, 2024
1 parent 136e6e7 commit fdca98d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
1 change: 1 addition & 0 deletions packages/core/src/awsService/ec2/sshKeyPair.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export class SshKeyPair {
}
return !(await tryRun('ssh-keygen', ['-t', keyType, '-N', '', '-q', '-f', keyPath], 'yes', 'unknown key type', {
onStdout: overrideKeys,
timeout: new Timeout(3000),
}))
}

Expand Down
5 changes: 0 additions & 5 deletions packages/core/src/shared/utilities/pathFind.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { GitExtension } from '../extensions/git'
import { Settings } from '../settings'
import { getLogger } from '../logger/logger'
import { mergeResolvedShellPath } from '../env/resolveEnv'
import { Timeout } from './timeoutUtils'

/** Full path to VSCode CLI. */
let vscPath: string
Expand All @@ -33,13 +32,9 @@ export async function tryRun(
p: string,
args: string[],
logging: 'yes' | 'no' | 'noresult' = 'yes',
timeout?: Timeout,
expected?: string,
opt?: ChildProcessOptions
): Promise<boolean> {
timeout?.onCompletion(() => {
throw new Error(`tryRun timed out: ${p} ${args.join(' ')}`)
})
const proc = new ChildProcess(p, args, { logging: 'no' })
const r = await proc.run({
...opt,
Expand Down

0 comments on commit fdca98d

Please sign in to comment.