Skip to content

process.execArgv does not include --watch or --watch-path options or their values on Windows #60594

@sangafabrice

Description

@sangafabrice

Version

v24.11.0

Platform

Microsoft Windows NT 10.0.19045.0 x64

Subsystem

process

What steps will reproduce the bug?

  1. Create a build.js file:
/** @file build.js */
import { execArgv } from "node:process";
console.warn(execArgv);
  1. Create an empty file named template.html (content does not matter).

  2. Run the following command:

(node --watch-path=template.html build.js & node --watch-path template.html build.js & node --watch build.js) > /dev/null

How often does it reproduce? Is there a required condition?

Always reproducible when --watch or --watch-path options are specified on the node command line.

What is the expected behavior? Why is that the expected behavior?

Expected output:

[ '--watch-path=template.html' ]
[ '--watch-path', 'template.html' ]
[ '--watch' ]

According to Node.js documentation, process.execArgv should contain the Node options passed before the script name.

What do you see instead?

[]
[]
[]

Additional information

Bash is installed on my Windows system. I used it in the reproduction steps because it makes it easier to chain blocking commands and run them in the background compared to PowerShell or Command Prompt.
Press Ctrl+C to terminate all background processes at once.

Metadata

Metadata

Assignees

No one assigned

    Labels

    watch-modeIssues and PRs related to watch mode

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions