Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
enableLogging: !!program.enableLogging,
runAsNode: !!program.runAsNode,
inspect: !!program.inspectElectron,
};
if (program.vscode && appArgs) {
// Args are in the format ~arg~ so we need to strip the "~"
appArgs = appArgs
.map((arg) => arg.substr(1, arg.length - 2))
.filter((arg) => arg.length > 0);
}
if (program.appPath) opts.appPath = program.appPath;
if (appArgs) opts.args = appArgs;
const spawned = await api.start(opts);
await new Promise((resolve) => {
const listenForExit = (child: ElectronProcess) => {
let onExit: NodeJS.ExitListener;
let onRestart: (newChild: ElectronProcess) => void;
const removeListeners = () => {
child.removeListener('exit', onExit);
child.removeListener('restarted', onRestart);
};
onExit = (code: number) => {
removeListeners();
if (spawned.restarted) return;
if (code !== 0) {
process.exit(code);
}
resolve();