File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed
packages/core/src/awsService/ec2 Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import os from 'os'
66import { fs , globals } from '../../shared'
77import { ToolkitError } from '../../shared/errors'
88import { tryRun } from '../../shared/utilities/pathFind'
9- import { Timeout } from '../../shared/utilities/timeoutUtils'
9+ import { Timeout , waitUntil } from '../../shared/utilities/timeoutUtils'
1010import { findAsync } from '../../shared/utilities/collectionUtils'
1111import { RunParameterContext } from '../../shared/utilities/processUtils'
1212
@@ -37,10 +37,20 @@ export class SshKeyPair {
3737 if ( ! keyGenerated ) {
3838 throw new ToolkitError ( 'ec2: Unable to generate ssh key pair with either ed25519 or rsa' )
3939 }
40- // This throws on windows.
41- // if (!(await fs.exists(keyPath))) {
42- // throw new ToolkitError(`ec2: Failed to generate keys, resulting key not found at ${keyPath}`)
43- // }
40+
41+ await waitUntil (
42+ async ( ) => {
43+ return await fs . exists ( keyPath )
44+ } ,
45+ {
46+ timeout : 29000 ,
47+ interval : 5000 ,
48+ }
49+ )
50+
51+ if ( ! ( await fs . exists ( keyPath ) ) ) {
52+ throw new ToolkitError ( `ec2: Failed to generate keys, resulting key not found at ${ keyPath } ` )
53+ }
4454 }
4555
4656 public static async generateSshKeyPair ( keyPath : string ) : Promise < void > {
You can’t perform that action at this time.
0 commit comments