mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
feat: support dns-result-order Node.js cli flag (#39501)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: deepak1556 <hop2deep@gmail.com>
This commit is contained in:
@@ -257,6 +257,30 @@ describe('utilityProcess module', () => {
|
||||
child.stdout!.on('data', listener);
|
||||
});
|
||||
|
||||
it('supports changing dns verbatim with --dns-result-order', (done) => {
|
||||
const child = utilityProcess.fork(path.join(fixturesPath, 'dns-result-order.js'), [], {
|
||||
stdio: 'pipe',
|
||||
execArgv: ['--dns-result-order=ipv4first']
|
||||
});
|
||||
|
||||
let output = '';
|
||||
const cleanup = () => {
|
||||
child.stderr!.removeListener('data', listener);
|
||||
child.stdout!.removeListener('data', listener);
|
||||
child.once('exit', () => { done(); });
|
||||
child.kill();
|
||||
};
|
||||
|
||||
const listener = (data: Buffer) => {
|
||||
output += data;
|
||||
expect(output.trim()).to.contain('ipv4first', 'default verbatim should be ipv4first');
|
||||
cleanup();
|
||||
};
|
||||
|
||||
child.stderr!.on('data', listener);
|
||||
child.stdout!.on('data', listener);
|
||||
});
|
||||
|
||||
ifit(process.platform !== 'win32')('supports redirecting stdout to parent process', async () => {
|
||||
const result = 'Output from utility process';
|
||||
const appProcess = childProcess.spawn(process.execPath, [path.join(fixturesPath, 'inherit-stdout'), `--payload=${result}`]);
|
||||
|
||||
3
spec/fixtures/api/utility-process/dns-result-order.js
vendored
Normal file
3
spec/fixtures/api/utility-process/dns-result-order.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
const dns = require('node:dns');
|
||||
console.log(dns.getDefaultResultOrder());
|
||||
process.exit(0);
|
||||
Reference in New Issue
Block a user