Skip to content

Commit 56d98c7

Browse files
committed
fix adjust reject to accept when missing substring
1 parent b5a90b8 commit 56d98c7

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

packages/core/src/awsService/ec2/sshKeyPair.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,16 @@ export class SshKeyPair {
7979
const overrideKeys = async (_t: string, proc: RunParameterContext) => {
8080
await proc.send('yes')
8181
}
82-
return !(await tryRun('ssh-keygen', ['-t', keyType, '-N', '', '-q', '-f', keyPath], 'yes', 'unknown key type', {
83-
onStdout: overrideKeys,
84-
timeout: new Timeout(5000),
85-
}))
82+
return await tryRun(
83+
'ssh-keygen',
84+
['-t', keyType, '-N', '', '-q', '-f', keyPath],
85+
'yes',
86+
/^(?!.*Unknown key type).*/i,
87+
{
88+
onStdout: overrideKeys,
89+
timeout: new Timeout(5000),
90+
}
91+
)
8692
}
8793

8894
public static async tryKeyTypes(keyPath: string, keyTypes: sshKeyType[]): Promise<boolean> {

0 commit comments

Comments
 (0)