File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
packages/core/src/awsService/ec2 Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 22 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
33 * SPDX-License-Identifier: Apache-2.0
44 */
5- import { fs } from '../../shared'
5+ import os from 'os'
6+ import { fs , globals } from '../../shared'
67import { ToolkitError } from '../../shared/errors'
78import { tryRun } from '../../shared/utilities/pathFind'
89import { Timeout } from '../../shared/utilities/timeoutUtils'
@@ -37,7 +38,11 @@ export class SshKeyPair {
3738 if ( ! keyGenerated || ! ( await fs . existsFile ( keyPath ) ) ) {
3839 throw new ToolkitError ( 'ec2: Unable to generate ssh key pair' )
3940 }
40- await fs . chmod ( keyPath , 0o600 )
41+ // Should already be the case, but just in case we assert permissions.
42+ // skip on Windows since it only allows write permission to be changed.
43+ if ( ! globals . isWeb && os . platform ( ) !== 'win32' ) {
44+ await fs . chmod ( keyPath , 0o600 )
45+ }
4146 }
4247 /**
4348 * Attempts to generate an ssh key pair. Returns true if successful, false otherwise.
You can’t perform that action at this time.
0 commit comments