Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
aryanjassal committed Sep 2, 2024
1 parent 630e648 commit 6bbcf10
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/secrets/CommandEdit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,25 @@ class CommandEdit extends CommandPolykey {
secretName: secretPath[1],
});
} catch (e) {
if (e.cause.name === 'ErrorSecretsSecretUndefined')
if (e.cause.name === 'ErrorSecretsSecretUndefined') {
secretExists = false;
else throw e;
} else {
throw e;
}
}
return [secretExists, response?.secretContent];
}, meta);
const tmpDir = await fs.promises.mkdtemp(
path.join(os.tmpdir(), 'polykey-'),
);
const tmpFile = path.join(tmpDir, 'pksecret');
if (secretExists)
if (secretExists) {
await this.fs.promises.writeFile(tmpFile, secretContent);
}
execSync(`$EDITOR \"${tmpFile}\"`, { stdio: 'inherit' });
let content: string;
try {
let tmpContent = await this.fs.promises.readFile(tmpFile);
const tmpContent = await this.fs.promises.readFile(tmpFile);
content = tmpContent.toString('binary');
if (!secretExists) {
await binUtils.retryAuthentication(async (auth) => {
Expand Down

0 comments on commit 6bbcf10

Please sign in to comment.