nodists / nodist

Natural node.js and npm version manager for windows.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why does nodist start two node.exe processes for each command I run?

mateodelnorte opened this issue · comments

I'm creating a continuous deployment solution, and I need to be able to kill all node processes except the one executing - and I need it to run on windows machines.

I was noticing that my script would terminate before end; it was acting like it's parent process died, but it shouldn't have had one. So, I tried opening up a single repl and doing a tasklist | grep node. Sure enough, 2 processes.

So, I did the following:

$ DEBUG="*" node
22:03:20.552 0ns    0ns    nodist:shim-node - current target directory: C:\development\ged
22:03:20.553 1000us 1000us nodist:shim - getTargetEngine: targetDir: C:\development\ged
22:03:20.554 1000us 1000us nodist:shim - getTargetEngine: ReadFile C:\development\ged\package.json
22:03:20.555 0ns    0ns    nodist:shim - parsePackageJSON: {Engines:{Npm: Node:}}
22:03:20.558 3ms    3ms    nodist:shim - Global file found: '6.10.3'
22:03:20.559 6ms    6ms    nodist:shim-node - Current version spec: 6.10.3
22:03:20.559 0ns    0ns    nodist:shim - checking 8.1.2 against 6.10.3
22:03:20.559 0ns    0ns    nodist:shim - checking 6.10.3 against 6.10.3
22:03:20.560 1000us 1000us nodist:shim-node - found matching version: 6.10.3
22:03:20.560 0ns    0ns    nodist:shim-node - Determined architecture: x64:%!s(bool=true)
22:03:20.560 0ns    0ns    nodist:shim-node - Going to execute the following binary: C:\Program Files (x86)\Nodist/v-x64/6.10.3/node.exe

It seems like nodist is doing something along the lines of using child_process to spawn a child node process, once it's discovered the appropriate exe.

Is this what's going on? Shouldn't it, instead just be doing a one-time symlink style process when you run nodist, itself?

Added note: when I directly execute the located binary, above, only a single node process ends up in the task list.

This definitely does not seem optimal.

Also see https://github.com/marcelklehr/nodist#known-issues ;)

There are version managers that do what you suggest. I don't use windows anymore, so I didn't bother to fix this.