lib: allow custom names for spawned processes
Checklist
-
make -j4 test
(UNIX), orvcbuild test nosign
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines
Affected core subsystem(s)
lib/child_process.js
Description of change
Add a name
parameter to the options
accepted by
child_process.spawn
that sets the spawned process name (argv[0]
)
to a custom value. The default behavior is unchanged if a name
parameter is not supplied.
It is useful to be able to set the name of a process you are spawning.
One motivating example is an application runner service that spawn
several other node applications. Instead of showing up as 20 different
node
processes, the application runner can give them meaningful names.
While child processes can write process.title
to change their name,
this has two limitations:
- it requires modifying all child processes
- it is limited to the length of the initial
argv[0]
in practice