Description
Pre-flight checklist
- I have read the contribution documentation for this project.
- I agree to follow the code of conduct that this project uses.
- I have searched the issue tracker for a bug that matches the one I want to file, without success.
Forge version
7.7.0
Electron version
v35.0.0
Operating system
Windows 11 24H2
Last known working Forge version
No response
Expected behavior
We encountered an issue when trying to pass arguments to electron
using the command electron-forge start -- --remote-debugging-port=9222
, which results in the error: error: unknown option '--remote-debugging-port=9222'
.
After debugging, we discovered that the electron-forge
command cannot handle the --
parameter separator correctly, which prevents electron
from receiving the argument --remote-debugging-port=9222
.
Actual behavior
We added direct debug print statements in the command file:
node_modules/@electron-forge/cli/dist/electron-forge-start.js
(async () => {
// ++++++++ debug print start ++++++++
console.log('process.argv', process.argv);
// ++++++++ debug print start ++++++++
let commandArgs = process.argv;
let appArgs;
const doubleDashIndex = process.argv.indexOf('--');
if (doubleDashIndex !== -1) {
commandArgs = process.argv.slice(0, doubleDashIndex);
appArgs = process.argv.slice(doubleDashIndex + 1);
}
})();
Run of the command:
PS C:\Work\projects\my-electron-ts-vite-app> npx electron-forge start -- --remote-debugging-port=9222
√ Checking your system
process.argv [
'C:\\Users\\xxx\\AppData\\Local\\fnm_multishells\\95900_1741453597461\\node.exe',
'C:\\Work\\projects\\my-electron-ts-vite-app\\node_modules\\@electron-forge\\cli\\dist\\electron-forge-start.js',
'--remote-debugging-port=9222'
]
error: unknown option '--remote-debugging-port=9222'
PS C:\Work\projects\my-electron-ts-vite-app> npx electron-forge start --- --remote-debugging-port=9222
√ Checking your system
process.argv [
'C:\\Users\\xxx\\AppData\\Local\\fnm_multishells\\95900_1741453597461\\node.exe',
'C:\\Work\\projects\\my-electron-ts-vite-app\\node_modules\\@electron-forge\\cli\\dist\\electron-forge-start.js',
'---',
'--remote-debugging-port=9222'
]
error: unknown option '---'
The --
argument disappears during the parameter passing, but ---
can be passed.
Steps to reproduce
npx electron-forge start --- --remote-debugging-port=9222
Additional information
No response