diff --git a/code.js b/code.js index e06d0a0..5a35d6d 100644 --- a/code.js +++ b/code.js @@ -12,8 +12,11 @@ const fd = fs.openSync("/proc/self/comm", fs.constants.O_WRONLY); fs.writeSync(fd, name); fs.closeSync(fd); -// Remove first command line argument (/usr/lib/code/code.js). - We call the CLI file first -process.argv.splice(0, 1); +// Remove electron command line arguments. +const argi = process.argv.findIndex((arg) => arg == "--"); +if (argi > -1) { + process.argv.splice(0, argi + 1); +} // Set application paths. const appPath = __dirname; diff --git a/code.sh b/code.sh index 55947fe..a064cfa 100644 --- a/code.sh +++ b/code.sh @@ -32,4 +32,4 @@ for line in "${ELECTRONMAPFILE[@]}"; do fi done -ELECTRON_RUN_AS_NODE=1 exec /usr/lib/${name}/electron /usr/lib/code/out/cli.js "${electronflags[@]}" /usr/lib/code/code.js "${codeflags[@]}" "$@" +ELECTRON_RUN_AS_NODE=1 exec /usr/lib/${name}/electron /usr/lib/code/out/cli.js "${electronflags[@]}" /usr/lib/code/code.js "${codeflags[@]}" -- "$@"