GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — doc,test: specify and test CLI option precedence rules · nodejs/node@b75822d

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • doc/api
    • cli.md
  • test/parallel
    • test-cli-options-precedence.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎doc/api/cli.md‎

Copy file name to clipboardExpand all lines: doc/api/cli.md
+6Lines changed: 6 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ dashes (`-`) or underscores (`_`).
3434

3535
For example, `--pending-deprecation` is equivalent to `--pending_deprecation`.
3636

37+
If an option that takes a single value, for example `--max-http-header-size`,
38+
is passed more than once, then the last passed value will be used. Options
39+
from the command line take precedence over options passed through the
40+
[`NODE_OPTIONS`][] environment variable.
41+
3742
### `-`
3843
<!-- YAML
3944
added: v8.0.0
@@ -1554,6 +1559,7 @@ $ node --max-old-space-size=1536 index.js
15541559
[`Atomics.wait()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Atomics/wait
15551560
[`Buffer`]: buffer.html#buffer_class_buffer
15561561
[`SlowBuffer`]: buffer.html#buffer_class_slowbuffer
1562+
[`NODE_OPTIONS`]: #cli_node_options_options
15571563
[`process.setUncaughtExceptionCaptureCallback()`]: process.html#process_process_setuncaughtexceptioncapturecallback_fn
15581564
[`tls.DEFAULT_MAX_VERSION`]: tls.html#tls_tls_default_max_version
15591565
[`tls.DEFAULT_MIN_VERSION`]: tls.html#tls_tls_default_min_version
Collapse file

‎test/parallel/test-cli-options-precedence.js‎

Copy file name to clipboard
+22Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
'use strict';
2+
require('../common');
3+
const assert = require('assert');
4+
const { spawnSync } = require('child_process');
5+
6+
// The last option on the command line takes precedence:
7+
assert.strictEqual(spawnSync(process.execPath, [
8+
'--max-http-header-size=1234',
9+
'--max-http-header-size=5678',
10+
'-p', 'http.maxHeaderSize'
11+
], {
12+
encoding: 'utf8'
13+
}).stdout.trim(), '5678');
14+
15+
// The command line takes precedence over NODE_OPTIONS:
16+
assert.strictEqual(spawnSync(process.execPath, [
17+
'--max-http-header-size=5678',
18+
'-p', 'http.maxHeaderSize'
19+
], {
20+
encoding: 'utf8',
21+
env: { ...process.env, NODE_OPTIONS: '--max-http-header-size=1234' }
22+
}).stdout.trim(), '5678');

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.