Skip to content

Commit f45195e

Browse files
committed
fix: trim newlines from discovered certutil path
1 parent 82c1f9b commit f45195e

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/index.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -230,18 +230,21 @@ function lookupOrInstallCertutil(installCertutil: boolean): boolean | string {
230230
debug('on mac, looking for homebrew (the only method for install nss supported by devcert');
231231
if (commandExists('brew')) {
232232
let nssPath: string;
233+
let certutilPath: string;
233234
try {
234-
let certutilPath = path.join(run('brew --prefix nss').toString(), 'bin', 'certutil');
235-
debug(`Found nss installed at ${ certutilPath }`);
236-
return certutilPath;
235+
certutilPath = path.join(run('brew --prefix nss').toString().trim(), 'bin', 'certutil');
237236
} catch (e) {
238237
debug('brew was found, but nss is not installed');
239238
if (installCertutil) {
240239
debug('attempting to install nss via brew');
241240
run('brew install nss');
242-
return path.join(run('brew --prefix nss').toString(), 'bin', 'certutil');
241+
certutilPath = path.join(run('brew --prefix nss').toString().trim(), 'bin', 'certutil');
242+
} else {
243+
return false;
243244
}
244245
}
246+
debug(`Found nss installed at ${ certutilPath }`);
247+
return certutilPath;
245248
}
246249
} else if (isLinux) {
247250
debug('on linux, checking is nss is already installed');
@@ -255,7 +258,7 @@ function lookupOrInstallCertutil(installCertutil: boolean): boolean | string {
255258
}
256259
}
257260
debug('looks like nss is installed');
258-
return run('which certutil').toString();
261+
return run('which certutil').toString().trim();
259262
}
260263
return false;
261264
}

0 commit comments

Comments
 (0)