-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Hi, thanks for this library!
I'm playing with it inside an Electron app and I've encountered a minor issue (with Electron). Short story: the Electron renderer process.env doesn't inherit the variables from the main process on Linux, which are available through renderer.process.env. So I have to use the which options to pass the PATH env variable.
I would basically like to do something like:
let opt = { path: remote.process.env.PATH };
detectBrowsers.getAvailableBrowsers(opt);Which can be achieved just adding the optional parameter to getAvailableBrowsers:
async function getExecutable(browser, opt) {
const execs = browsers[browser];
if(!execs || !execs[process.platform]) return;
for(const exec of execs[process.platform]) {
const executable = await which(exec, opt).catch(()=>{});
if(executable) return executable;
}
}
async function getAvailableBrowsers(opt) {
const list = [];
for(const browser of Object.keys(browsers)) {
const exec = await getExecutable(browser, opt);
if(exec) list.push({ browser, path: exec });
}
return list;
}I guess passing options to the which module could be useful in some other cases, so it would be nice if a future release included the ability to do it somehow.
Subash
Metadata
Metadata
Assignees
Labels
No labels