| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent fab8eb6 commit 1037463
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,33 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + const common = require('../common'); | ||
| 3 | + const assert = require('assert'); | ||
| 4 | + | ||
| 5 | + // Verify that customFds is used if stdio is not provided. | ||
| 6 | + { | ||
| 7 | + const msg = 'child_process: options.customFds option is deprecated. ' + | ||
| 8 | + 'Use options.stdio instead.'; | ||
| 9 | + common.expectWarning('DeprecationWarning', msg); | ||
| 10 | + | ||
| 11 | + const customFds = [-1, process.stdout.fd, process.stderr.fd]; | ||
| 12 | + const child = common.spawnSyncPwd({ customFds }); | ||
| 13 | + | ||
| 14 | + assert.deepStrictEqual(child.options.customFds, customFds); | ||
| 15 | + assert.deepStrictEqual(child.options.stdio, [ | ||
| 16 | + { type: 'pipe', readable: true, writable: false }, | ||
| 17 | + { type: 'fd', fd: process.stdout.fd }, | ||
| 18 | + { type: 'fd', fd: process.stderr.fd } | ||
| 19 | + ]); | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + // Verify that customFds is ignored when stdio is present. | ||
| 23 | + { | ||
| 24 | + const customFds = [0, 1, 2]; | ||
| 25 | + const child = common.spawnSyncPwd({ customFds, stdio: 'pipe' }); | ||
| 26 | + | ||
| 27 | + assert.deepStrictEqual(child.options.customFds, customFds); | ||
| 28 | + assert.deepStrictEqual(child.options.stdio, [ | ||
| 29 | + { type: 'pipe', readable: true, writable: false }, | ||
| 30 | + { type: 'pipe', readable: false, writable: true }, | ||
| 31 | + { type: 'pipe', readable: false, writable: true } | ||
| 32 | + ]); | ||
| 33 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments