-
-
Notifications
You must be signed in to change notification settings - Fork 34.4k
Closed
Labels
windowsIssues and PRs related to the Windows platform.Issues and PRs related to the Windows platform.
Description
- Version:
v10.5.0 - Platform: Windows 10 (64-Bit)
- Subsystem: not sure, we use a corporate proxy though
Utilising child_process.execFile at windows takes minutes to finish.
To demonstrate the bug I created a timed script, running npm whoami first and git status afterwards. I compared those measured results between MacOS and Windows. Following are my results and all the details:
Test run with native child_process.execFile
| Run | MacOS | Windows | Slower by |
|---|---|---|---|
1 npm whoami |
1256.060359 ms = 1.256 sec |
189733.792206 ms = 189.7338 sec = 3.162 min |
151.0547 times |
2 git status |
16.693848 ms (x75.24091264039304 times faster) |
161.197277 ms (x1177.02851894948573 times faster) |
9.6561 times |
test script:
const { execFile } = require('child_process');
const precise = require('precise');
const timer = precise();
// Node does not support PATHEXT on Windows
const npmCmd = process.platform === 'win32' ? 'npm.cmd' : 'npm';
timer.start();
execFile(npmCmd, ['whoami'], (error, stdout, stderr) => {
timer.stop();
console.log('Message received in', timer.diff() / 1000000, 'ms');
if (error) {
console.error(error);
} else {
console.log(stdout);
}
const timer2 = precise();
timer2.start();
execFile('git', ['status'], (error, stdout, stderr) => {
timer2.stop();
console.log('Message received in', timer2.diff() / 1000000, 'ms');
if (error) {
console.error(error);
} else {
console.log(stdout);
}
});
});Windows 10:
C:\eplatform\git-repos\patterns-library>npm run test-child-spawn-nodejs
> @axa-ch/patterns-library@2.0.1-beta.160 test-child-spawn-nodejs C:\eplatform\git-repos\patterns-library
> node ./stack/tasks/test-child-spawn-nodejs.js
Message received in 189733.792206 ms
user-name
Message received in 161.197277 ms
On branch bugfix/windows-spawn-hangs
Your branch is up-to-date with 'origin/bugfix/windows-spawn-hangs'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
.idea/
patterns-library.iml
nothing added to commit but untracked files present (use "git add" to track)Mac OSX El Capitan Version 10.11.6:
npm run test-child-spawn-nodejs
> @axa-ch/patterns-library@2.0.1-beta.160 test-child-spawn-nodejs /Users/axawinterthur/dev/axa-ch_style-html-guide
> node ./stack/tasks/test-child-spawn-nodejs.js
Message received in 1256.060359 ms
andyogo
Message received in 16.693848 ms
On branch bugfix/windows-spawn-hangs
Your branch is up-to-date with 'github/bugfix/windows-spawn-hangs'.
nothing to commit, working tree cleanRelated Bugs (but all closed, why?):
Btw PATHEXT is still not supported on windows, why is the related bugs closed then?
nodejs/node-v0.x-archive#2318
storm1ng, gt3, Gudahtt, Daniel15, NE-SmallTown and 3 more
Metadata
Metadata
Assignees
Labels
windowsIssues and PRs related to the Windows platform.Issues and PRs related to the Windows platform.