Description
In src/modules/frontendlib.js specifically inside waitForFrontendLibApp function, the default value for waitTimeout is assigned using a bitwise OR (|) operator instead of a logical OR (||) or nullish coalescing operator (??).
// Current implementation in src/modules/frontendlib.js (line 117)
let timeout = configObj.cli && configObj.cli.frontendLibrary && configObj.cli.frontendLibrary.waitTimeout | 20000;
Steps to Reproduce
- Create a Neutralinojs project with a frontend library (e.g., Vite + React, which runs on port
5173 by default).
- In
neutralino.config.json, configure frontendLibrary with a wrong devUrl port (e.g., 3000) to force the timeout to trigger, and set a custom waitTimeout:
{
"cli": {
"frontendLibrary": {
"devCommand": "npm run dev",
"devUrl": "http://localhost:3000",
"waitTimeout": 5000
}
}
}
- Run
neu run. Since port 3000 is never used by Vite, the CLI will wait until the timeout expires.
Expected Behavior
The CLI should time out after exactly 5 seconds (5000 ms) with a timeout error.
Actual Behavior
The CLI performs a bitwise operation: 5000 | 20000.
- Binary of 5000:
1001110001000
- Binary of 20000:
100111000100000
- Result (24488):
101111110101000
The CLI times out after approximately 24.5 seconds instead of the configured 5 seconds.
Description
In
src/modules/frontendlib.jsspecifically insidewaitForFrontendLibAppfunction, the default value forwaitTimeoutis assigned using a bitwise OR (|) operator instead of a logical OR (||) or nullish coalescing operator (??).Steps to Reproduce
5173by default).neutralino.config.json, configurefrontendLibrarywith a wrongdevUrlport (e.g.,3000) to force the timeout to trigger, and set a customwaitTimeout:{ "cli": { "frontendLibrary": { "devCommand": "npm run dev", "devUrl": "http://localhost:3000", "waitTimeout": 5000 } } }neu run. Since port3000is never used by Vite, the CLI will wait until the timeout expires.Expected Behavior
The CLI should time out after exactly 5 seconds (
5000ms) with a timeout error.Actual Behavior
The CLI performs a bitwise operation:
5000 | 20000.1001110001000100111000100000101111110101000The CLI times out after approximately 24.5 seconds instead of the configured 5 seconds.