Skip to content

Commit 61e2dfe

Browse files
committed
process: add execve to diagnostic_channel
1 parent 2d3f0b4 commit 61e2dfe

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

doc/api/diagnostics_channel.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,6 +1319,14 @@ added: v16.18.0
13191319

13201320
Emitted when a new process is created.
13211321

1322+
`execve`
1323+
1324+
* `execPath` {string}
1325+
* `args` {string\[]}
1326+
* `env` {string\[]}
1327+
1328+
Emitted when [`process.execve()`][] is invoked.
1329+
13221330
#### Worker Thread
13231331

13241332
<!-- YAML
@@ -1348,5 +1356,6 @@ Emitted when a new thread is created.
13481356
[`end` event]: #endevent
13491357
[`error` event]: #errorevent
13501358
[`net.Server.listen()`]: net.md#serverlisten
1359+
[`process.execve()`]: process.md#processexecvefile-args-env
13511360
[`start` event]: #startevent
13521361
[context loss]: async_context.md#troubleshooting-context-loss

doc/api/process.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3342,7 +3342,7 @@ In custom builds from non-release versions of the source tree, only the
33423342
`name` property may be present. The additional properties should not be
33433343
relied upon to exist.
33443344
3345-
## `process.execve(file\[, args\[, env]])`
3345+
## `process.execve(file[, args[, env]])`
33463346
33473347
<!-- YAML
33483348
added: REPLACEME

lib/internal/process/per_thread.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ const {
5454
validateString,
5555
} = require('internal/validators');
5656

57+
const dc = require('diagnostics_channel');
58+
const execveDiagnosticChannel = dc.channel('process.execve');
59+
5760
const constants = internalBinding('constants').os.signals;
5861

5962
let getValidatedPath; // We need to lazy load it because of the circular dependency.
@@ -317,6 +320,10 @@ function wrapProcessMethods(binding) {
317320
}
318321
}
319322

323+
if (execveDiagnosticChannel.hasSubscribers) {
324+
execveDiagnosticChannel.publish({ execPath, args, env: envArray });
325+
}
326+
320327
// Perform the system call
321328
_execve(execPath, args, envArray);
322329
}

0 commit comments

Comments
 (0)