@@ -65,3 +65,31 @@ assert.deepStrictEqual(ret_err.spawnargs, ['bar']);
6565 ] ;
6666 assert . deepStrictEqual ( retUTF8 . output , stringifiedDefault ) ;
6767}
68+
69+ {
70+ // Verify support for stdio.wrap via using another child process stream.
71+ // This is the same logic as in ch_sy.js, expressed as a deterministic test.
72+ if ( common . isWindows ) {
73+ common . skip ( 'Not applicable on Windows' ) ;
74+ }
75+
76+ const { spawn } = require ( 'child_process' ) ;
77+ const childA = spawn ( process . execPath ,
78+ [ '-e' , 'process.stdin.pipe(process.stdout);' ] ,
79+ { stdio : [ 'pipe' , 'pipe' , 'ignore' ] } ) ;
80+
81+ let collected = '' ;
82+ childA . stdout . setEncoding ( 'utf8' ) ;
83+ childA . stdout . on ( 'data' , ( chunk ) => { collected += chunk ; } ) ;
84+
85+ childA . on ( 'exit' , common . mustCall ( ( code ) => {
86+ assert . strictEqual ( code , 0 ) ;
87+ assert . strictEqual ( collected , 'hi' ) ;
88+ } ) ) ;
89+
90+ const result = spawnSync ( process . execPath ,
91+ [ '-e' , 'process.stdout.write("hi")' ] ,
92+ { stdio : [ 'inherit' , childA . stdin , 'inherit' ] } ) ;
93+
94+ assert . strictEqual ( result . status , 0 ) ;
95+ }
0 commit comments