Skip to content

Bug: Incorrect bitwise OR operator used for waitTimeout in frontendlib.js #401

@salehahmed99

Description

@salehahmed99

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

  1. Create a Neutralinojs project with a frontend library (e.g., Vite + React, which runs on port 5173 by default).
  2. 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
        }
      }
    }
  3. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions