Skip to content

Commit 7a10600

Browse files
committed
fixup: don't exhaust exec buffer
1 parent e2192a3 commit 7a10600

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

test/parallel/test-child-process-exec-any-shells-windows.js

+10-6
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,16 @@ test('CMD');
4343
test('powershell');
4444
testCopy('powershell.exe',
4545
`${system32}\\WindowsPowerShell\\v1.0\\powershell.exe`);
46-
cp.exec(`Get-ChildItem "${__dirname}" | Select-Object -Property Name`,
47-
{ shell: 'PowerShell' }, common.mustCall((error, stdout, stderror) => {
48-
assert.ok(!error && !stderror);
49-
assert.ok(stdout.includes(
50-
'test-child-process-exec-any-shells-windows.js'));
51-
}));
46+
fs.writeFile(`${tmpPath}\\test file`, 'Test', common.mustCall((err) => {
47+
assert.ifError(err);
48+
cp.exec(`Get-ChildItem "${tmpPath}" | Select-Object -Property Name`,
49+
{ shell: 'PowerShell' },
50+
common.mustCall((error, stdout, stderror) => {
51+
assert.ok(!error && !stderror);
52+
assert.ok(stdout.includes(
53+
'test file'));
54+
}));
55+
}));
5256

5357
// Test Bash (from WSL and Git), if available
5458
cp.exec('where bash', common.mustCall((error, stdout) => {

0 commit comments

Comments
 (0)