Skip to content

Commit

Permalink
fix: properly invoke callbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
tnoonan-salesforce committed Mar 26, 2019
1 parent f94f127 commit f03838c
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/keyChainImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -567,16 +567,21 @@ export class GenericUnixKeychainAccess extends GenericKeychainAccess {
*/
export class GenericWindowsKeychainAccess extends GenericKeychainAccess {
protected async isValidFileAccess(cb: (error: Nullable<Error>) => Promise<void>): Promise<void> {
const secretFile: string = path.join(
await ConfigFile.resolveRootFolder(true),
Global.STATE_FOLDER,
ensure(KeychainConfig.getDefaultOptions().filename)
);
await super.isValidFileAccess(async err => {
if (err != null) {
await cb(err);
} else {
await fs.access(path.join(secretFile, Global.STATE_FOLDER), fs.constants.R_OK | fs.constants.W_OK);
const secretFile: string = path.join(
await ConfigFile.resolveRootFolder(true),
Global.STATE_FOLDER,
ensure(KeychainConfig.getDefaultOptions().filename)
);
try {
await fs.access(secretFile, fs.constants.R_OK | fs.constants.W_OK);
await cb(null);
} catch (e) {
await cb(err);
}
}
});
}
Expand Down

0 comments on commit f03838c

Please sign in to comment.