process: correctly parse Unicode in NODE_OPTIONS by bzoz · Pull Request #34476 · nodejs/node · GitHub
Skip to content
Closed
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
16 changes: 14 additions & 2 deletions src/node_credentials.cc
26 changes: 26 additions & 0 deletions test/parallel/test-unicode-node-options.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
'use strict';
// Flags: --expose-internals
require('../common');
const { getOptionValue } = require('internal/options');
const assert = require('assert');
const cp = require('child_process');

const expected_redirect_value = 'foó';

if (process.argv.length === 2) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I'd prefer to have explicit check for 'child process' case (i.e. if (process.argv[2] === 'test') {) instead to handle possibly different test start args.

const NODE_OPTIONS = `--redirect-warnings=${expected_redirect_value}`;
const result = cp.spawnSync(process.argv0,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

['--expose-internals', __filename, 'test'],
{
env: {
...process.env,
NODE_OPTIONS
},
stdio: 'inherit'
});
assert.strictEqual(result.status, 0);
} else {
const redirect_value = getOptionValue('--redirect-warnings');
console.log(`--redirect-warings=${redirect_value}`);
assert.strictEqual(redirect_value, expected_redirect_value);
}