Skip to content

doc: revised description of execFile to clarify usage

I used child_process.execFile to execute a JS file. The docs state this: child_process.execFile(file[, args][, options][, callback]) file: The name or path of the executable file to run.

This failed:

execFile("node filename.js", { cwd: "path_to_file" })

This worked:

execFile("node", ["filename.js"], { cwd: "path_to_file" })

The docs were confusing for me as it states the file to be executed should be passed as the first parameter. Rather, the command needed to be passed as the first parameter, with the file passed in as an arg. I believe the clarification I've submitted will be more clear and will help others avoid my confusion. Thanks for your consideration.

Checklist
Affected core subsystem(s)

doc

Merge request reports

Loading