mirror of
https://github.com/serverless/serverless.git
synced 2026-01-18 14:58:43 +00:00
Do not tweak file access on Windows
This commit is contained in:
parent
7ac85e4d12
commit
f6b05ab801
@ -9,6 +9,7 @@ const homedir = os.homedir();
|
||||
const awsConfigDirPath = join(homedir, '.aws');
|
||||
const credentialsFilePath = homedir ? join(awsConfigDirPath, 'credentials') : null;
|
||||
|
||||
const isWindows = process.platform === 'win32';
|
||||
const profileNameRe = /^\[([^\]]+)]\s*$/;
|
||||
const settingRe = /^([a-zA-Z0-9_]+)\s*=\s*([^\s]+)\s*$/;
|
||||
const settingMap = new Map([
|
||||
@ -47,11 +48,11 @@ const writeCredentialsContent = content =>
|
||||
writeFile(
|
||||
credentialsFilePath,
|
||||
content,
|
||||
{ mode: constants.S_IRUSR | constants.S_IWUSR },
|
||||
!isWindows ? { mode: constants.S_IRUSR | constants.S_IWUSR } : null,
|
||||
writeFileError => {
|
||||
if (writeFileError) {
|
||||
if (writeFileError.code === 'ENOENT') {
|
||||
mkdir(awsConfigDirPath, { mode: constants.S_IRWXU }, mkdirError => {
|
||||
mkdir(awsConfigDirPath, !isWindows ? { mode: constants.S_IRWXU } : null, mkdirError => {
|
||||
if (mkdirError) reject(mkdirError);
|
||||
else resolve(writeCredentialsContent(content));
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user