Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions doc/api/child_process.md
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,6 @@ the error passed to the callback will be an `AbortError`:

```cjs
const { fork } = require('node:child_process');
const process = require('node:process');

if (process.argv[2] === 'child') {
setTimeout(() => {
Expand Down Expand Up @@ -933,7 +932,6 @@ Example of a long-running process, by detaching and also ignoring its parent

```cjs
const { spawn } = require('node:child_process');
const process = require('node:process');

const subprocess = spawn(process.argv[0], ['child_program.js'], {
detached: true,
Expand Down Expand Up @@ -1077,7 +1075,6 @@ pipes between the parent and child. The value is one of the following:

```cjs
const { spawn } = require('node:child_process');
const process = require('node:process');

// Child will use parent's stdios.
spawn('prg', [], { stdio: 'inherit' });
Expand Down Expand Up @@ -1833,7 +1830,6 @@ process to wait for the child process to exit before exiting itself.

```cjs
const { spawn } = require('node:child_process');
const process = require('node:process');

const subprocess = spawn(process.argv[0], ['child_program.js'], {
detached: true,
Expand Down Expand Up @@ -2289,7 +2285,6 @@ the child and the parent processes.

```cjs
const { spawn } = require('node:child_process');
const process = require('node:process');

const subprocess = spawn(process.argv[0], ['child_program.js'], {
detached: true,
Expand Down
3 changes: 0 additions & 3 deletions doc/api/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ if (cluster.isPrimary) {
const cluster = require('node:cluster');
const http = require('node:http');
const numCPUs = require('node:os').availableParallelism();
const process = require('node:process');

if (cluster.isPrimary) {
console.log(`Primary ${process.pid} is running`);
Expand Down Expand Up @@ -318,7 +317,6 @@ if (cluster.isPrimary) {
const cluster = require('node:cluster');
const http = require('node:http');
const numCPUs = require('node:os').availableParallelism();
const process = require('node:process');

if (cluster.isPrimary) {

Expand Down Expand Up @@ -541,7 +539,6 @@ if (cluster.isPrimary) {
const cluster = require('node:cluster');
const http = require('node:http');
const numCPUs = require('node:os').availableParallelism();
const process = require('node:process');

if (cluster.isPrimary) {
console.log(`Primary ${process.pid} is running`);
Expand Down
6 changes: 0 additions & 6 deletions doc/api/perf_hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -1682,7 +1682,6 @@ setImmediate(() => {
```

```cjs
'use strict';
const { eventLoopUtilization } = require('node:perf_hooks');
const { spawnSync } = require('node:child_process');

Expand Down Expand Up @@ -2132,7 +2131,6 @@ setTimeout(() => {}, 1000);
```

```cjs
'use strict';
const async_hooks = require('node:async_hooks');
const {
performance,
Expand Down Expand Up @@ -2202,7 +2200,6 @@ await timedImport('some-module');
<!-- eslint-disable no-global-assign -->

```cjs
'use strict';
const {
performance,
PerformanceObserver,
Expand Down Expand Up @@ -2259,7 +2256,6 @@ createServer((req, res) => {
```

```cjs
'use strict';
const { PerformanceObserver } = require('node:perf_hooks');
const http = require('node:http');

Expand Down Expand Up @@ -2301,7 +2297,6 @@ createServer((socket) => {
```

```cjs
'use strict';
const { PerformanceObserver } = require('node:perf_hooks');
const net = require('node:net');
const obs = new PerformanceObserver((items) => {
Expand Down Expand Up @@ -2335,7 +2330,6 @@ promises.resolve('localhost');
```

```cjs
'use strict';
const { PerformanceObserver } = require('node:perf_hooks');
const dns = require('node:dns');
const obs = new PerformanceObserver((items) => {
Expand Down
53 changes: 2 additions & 51 deletions doc/api/process.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Node.js process.
import process from 'node:process';
```

<!-- eslint-disable no-restricted-syntax -->

```cjs
const process = require('node:process');
```
Expand Down Expand Up @@ -62,8 +64,6 @@ console.log('This message is displayed first.');
```

```cjs
const process = require('node:process');

process.on('beforeExit', (code) => {
console.log('Process beforeExit event with code: ', code);
});
Expand Down Expand Up @@ -120,8 +120,6 @@ process.on('exit', (code) => {
```

```cjs
const process = require('node:process');

process.on('exit', (code) => {
console.log(`About to exit with code: ${code}`);
});
Expand All @@ -143,8 +141,6 @@ process.on('exit', (code) => {
```

```cjs
const process = require('node:process');

process.on('exit', (code) => {
setTimeout(() => {
console.log('This will not run');
Expand Down Expand Up @@ -221,8 +217,6 @@ process.on('rejectionHandled', (promise) => {
```

```cjs
const process = require('node:process');

const unhandledRejections = new Map();
process.on('unhandledRejection', (reason, promise) => {
unhandledRejections.set(promise, reason);
Expand Down Expand Up @@ -305,7 +299,6 @@ console.log('This will not run.');
```

```cjs
const process = require('node:process');
const fs = require('node:fs');

process.on('uncaughtException', (err, origin) => {
Expand Down Expand Up @@ -394,8 +387,6 @@ nonexistentFunc();
```

```cjs
const process = require('node:process');

process.on('uncaughtExceptionMonitor', (err, origin) => {
MyMonitoringTool.logSync(err, origin);
});
Expand Down Expand Up @@ -445,8 +436,6 @@ somePromise.then((res) => {
```

```cjs
const process = require('node:process');

process.on('unhandledRejection', (reason, promise) => {
console.log('Unhandled Rejection at:', promise, 'reason:', reason);
// Application specific logging, throwing an error, or other logic here
Expand All @@ -473,8 +462,6 @@ const resource = new SomeResource();
```

```cjs
const process = require('node:process');

function SomeResource() {
// Initially set the loaded status to a rejected promise
this.loaded = Promise.reject(new Error('Resource not yet loaded!'));
Expand Down Expand Up @@ -526,8 +513,6 @@ process.on('warning', (warning) => {
```

```cjs
const process = require('node:process');

process.on('warning', (warning) => {
console.warn(warning.name); // Print the warning name
console.warn(warning.message); // Print the warning message
Expand Down Expand Up @@ -663,8 +648,6 @@ process.on('SIGTERM', handle);
```

```cjs
const process = require('node:process');

// Begin reading from stdin so the process does not exit.
process.stdin.resume();

Expand Down Expand Up @@ -767,8 +750,6 @@ process.addUncaughtExceptionCaptureCallback((err) => {
```

```cjs
const process = require('node:process');

process.addUncaughtExceptionCaptureCallback((err) => {
console.error('Caught exception:', err.message);
return true; // Indicates exception was handled
Expand Down Expand Up @@ -1218,8 +1199,6 @@ process.debugPort = 5858;
```

```cjs
const process = require('node:process');

process.debugPort = 5858;
```

Expand Down Expand Up @@ -1356,8 +1335,6 @@ process.on('warning', (warning) => {
```

```cjs
const process = require('node:process');

process.on('warning', (warning) => {
console.warn(warning.name); // 'Warning'
console.warn(warning.message); // 'Something happened!'
Expand Down Expand Up @@ -1449,8 +1426,6 @@ process.on('warning', (warning) => {
```

```cjs
const process = require('node:process');

process.on('warning', (warning) => {
console.warn(warning.name);
console.warn(warning.message);
Expand Down Expand Up @@ -1866,8 +1841,6 @@ if (someConditionNotMet()) {
```

```cjs
const process = require('node:process');

// How to properly set the exit code while letting
// the process exit gracefully.
if (someConditionNotMet()) {
Expand Down Expand Up @@ -2409,8 +2382,6 @@ if (process.getegid) {
```

```cjs
const process = require('node:process');

if (process.getegid) {
console.log(`Current gid: ${process.getegid()}`);
}
Expand Down Expand Up @@ -2439,8 +2410,6 @@ if (process.geteuid) {
```

```cjs
const process = require('node:process');

if (process.geteuid) {
console.log(`Current uid: ${process.geteuid()}`);
}
Expand Down Expand Up @@ -2469,8 +2438,6 @@ if (process.getgid) {
```

```cjs
const process = require('node:process');

if (process.getgid) {
console.log(`Current gid: ${process.getgid()}`);
}
Expand Down Expand Up @@ -2500,8 +2467,6 @@ if (process.getgroups) {
```

```cjs
const process = require('node:process');

if (process.getgroups) {
console.log(process.getgroups()); // [ 16, 21, 297 ]
}
Expand Down Expand Up @@ -2530,8 +2495,6 @@ if (process.getuid) {
```

```cjs
const process = require('node:process');

if (process.getuid) {
console.log(`Current uid: ${process.getuid()}`);
}
Expand Down Expand Up @@ -2736,8 +2699,6 @@ kill(process.pid, 'SIGHUP');
```

```cjs
const process = require('node:process');

process.on('SIGHUP', () => {
console.log('Got SIGHUP signal.');
});
Expand Down Expand Up @@ -3853,8 +3814,6 @@ if (process.getegid && process.setegid) {
```

```cjs
const process = require('node:process');

if (process.getegid && process.setegid) {
console.log(`Current gid: ${process.getegid()}`);
try {
Expand Down Expand Up @@ -3898,8 +3857,6 @@ if (process.geteuid && process.seteuid) {
```

```cjs
const process = require('node:process');

if (process.geteuid && process.seteuid) {
console.log(`Current uid: ${process.geteuid()}`);
try {
Expand Down Expand Up @@ -3943,8 +3900,6 @@ if (process.getgid && process.setgid) {
```

```cjs
const process = require('node:process');

if (process.getgid && process.setgid) {
console.log(`Current gid: ${process.getgid()}`);
try {
Expand Down Expand Up @@ -3988,8 +3943,6 @@ if (process.getgroups && process.setgroups) {
```

```cjs
const process = require('node:process');

if (process.getgroups && process.setgroups) {
try {
process.setgroups([501]);
Expand Down Expand Up @@ -4032,8 +3985,6 @@ if (process.getuid && process.setuid) {
```

```cjs
const process = require('node:process');

if (process.getuid && process.setuid) {
console.log(`Current uid: ${process.getuid()}`);
try {
Expand Down
2 changes: 0 additions & 2 deletions doc/api/sqlite.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ console.log(query.all());
```

```cjs
'use strict';
const { DatabaseSync } = require('node:sqlite');
const database = new DatabaseSync(':memory:');

Expand Down Expand Up @@ -327,7 +326,6 @@ database.loadExtension('./base64.dylib', 'sqlite3_base64_init');
```

```cjs
'use strict';
const { DatabaseSync } = require('node:sqlite');
const database = new DatabaseSync(':memory:', { allowExtension: true });

Expand Down
1 change: 0 additions & 1 deletion doc/api/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,6 @@ test('spies on a function', () => {
```

```cjs
'use strict';
const assert = require('node:assert');
const { mock, test } = require('node:test');

Expand Down
2 changes: 0 additions & 2 deletions doc/api/tracing.md
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,6 @@ collect();
```

```cjs
'use strict';

const { Session } = require('node:inspector');
const session = new Session();
session.connect();
Expand Down
Loading
Loading