File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,11 @@ dashes (`-`) or underscores (`_`).
3434
3535For 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
3944added: v8.0.0
@@ -1487,6 +1492,7 @@ $ node --max-old-space-size=1536 index.js
14871492[ `--openssl-config` ] : #cli_openssl_config_file
14881493[ `Buffer` ] : buffer.html#buffer_class_buffer
14891494[ `SlowBuffer` ] : buffer.html#buffer_class_slowbuffer
1495+ [ `NODE_OPTIONS` ] : #cli_node_options_options
14901496[ `process.setUncaughtExceptionCaptureCallback()` ] : process.html#process_process_setuncaughtexceptioncapturecallback_fn
14911497[ `tls.DEFAULT_MAX_VERSION` ] : tls.html#tls_tls_default_max_version
14921498[ `tls.DEFAULT_MIN_VERSION` ] : tls.html#tls_tls_default_min_version
Original file line number Diff line number Diff line change 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' ) ;
You can’t perform that action at this time.
0 commit comments