From e56bf2d760a19f4fe86ece9f236a7fc0fc02c727 Mon Sep 17 00:00:00 2001 From: Paolo Insogna Date: Wed, 8 Jan 2025 07:10:50 +0100 Subject: [PATCH] process: update documentation --- doc/api/process.md | 3 ++- test/parallel/test-process-execve-on-exit.js | 5 ++--- test/parallel/test-process-execve-socket.js | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/api/process.md b/doc/api/process.md index ef0edfc000f6e7..59312d21c59428 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -3321,7 +3321,8 @@ This is achieved by using the `execve` Unix function and therefore no memory or resources from the current process are preserved, except for the standard input, standard output and standard error file descriptor. -All other resources are discarded by system when the processes are swapped. +All other resources are discarded by the system when the processes are swapped, without triggering +any exit or close events and without running any cleanup handler. This function will never return, unless an error occurred. diff --git a/test/parallel/test-process-execve-on-exit.js b/test/parallel/test-process-execve-on-exit.js index b4237496e8a715..a2d140a5a62034 100644 --- a/test/parallel/test-process-execve-on-exit.js +++ b/test/parallel/test-process-execve-on-exit.js @@ -1,6 +1,6 @@ 'use strict'; -const { isMainThread, mustCall, mustNotCall, skip, isWindows } = require('../common'); +const { isMainThread, mustNotCall, skip, isWindows } = require('../common'); const { strictEqual } = require('assert'); if (!isMainThread) { @@ -10,9 +10,8 @@ if (!isMainThread) { } if (process.argv[2] === 'replaced') { - process.on('beforeExit', mustCall()); strictEqual(process.argv[2], 'replaced'); } else { - process.on('beforeExit', mustNotCall()); + process.on('exit', mustNotCall()); process.execve(process.execPath, [__filename, 'replaced']); } diff --git a/test/parallel/test-process-execve-socket.js b/test/parallel/test-process-execve-socket.js index 5cb860ebc064ad..30a7c159a35bc9 100644 --- a/test/parallel/test-process-execve-socket.js +++ b/test/parallel/test-process-execve-socket.js @@ -23,6 +23,7 @@ if (process.argv[2] === 'replaced') { // Create a new socket server const server = createServer(); + server.on('close', mustNotCall()); server.listen(0, mustCall(() => { const port = server.address().port;