inspect-process
inspect-process copied to clipboard
Document how to run executables under Windows
The documentation currently says that you can run executables like this:
inspect grunt
but under Windows, npm actually installs cmd files (e.g. gulp.cmd) which get picked up instead of gulp.js. As a result, users get silly errors like this: https://github.com/gulpjs/gulp/issues/426#issuecomment-44325338
It turns out that you can resolve this problem by passing a fully-qualified path to gulp.js, as follows:
inspect %USERPROFILE%\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js
Can you please add a small warning in the Wiki that Windows users will need to do something like this? Even nicer, it would be great if the code would automagically do the right thing under Windows (know to look for the js file instead of the cmd files). These seem to always be under <module>\bin\<module>.js
.
I would say that automatically doing the right thing (resolving a path) is out of scope for this module. And could be confusing. Documentation is probably useful. I'm the readme. That's my 2c.
On Fri, Jan 6, 2017, 06:23 Gili Tzabari [email protected] wrote:
The documentation currently says that you can run executables like this:
inspect grunt
but under Windows, npm actually installs cmd files (e.g. gulp.cmd) which get picked up instead of gulp.js. As a result, users get silly errors like this: gulpjs/gulp#426 (comment) https://github.com/gulpjs/gulp/issues/426#issuecomment-44325338
It turns out that you can resolve this problem by passing a fully-qualified path to gulp.js, as follows:
inspect %USERPROFILE%\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js
Can you please add a small warning in the Wiki that Windows users will need to do something like this? Even nicer, it would be great if the code would automagically do the right thing under Windows (know to look for the js file instead of the cmd files). These seem to always be under
\bin<module>.js. — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jaridmargolin/inspect-process/issues/27, or mute the thread https://github.com/notifications/unsubscribe-auth/AAmyx_cSDWKC60AFGh6FO2Ccq81fnAnyks5rPcHdgaJpZM4LcZKC .
@cowwoc @mightyiam - one comment in the thread suggested the following fix on windows node --debug $(which gulp) taskname
... Under the hood inspect-process
actually attempts to use which
(or at least a node port of it). I will be willing to investigate the issue further to see if there is a possible solution. If there is not, I will definitely update the README.
Thanks for the report.
@jaridmargolin I don't see how that could work seeing as:
-
which
doesn't ship out-of-the-box with Windows. - When I invoke
which gulp
under my system (after manually installingwhich
) I get no match, butwhich gulp.cmd
does get a match. Even ifwhich
was somehow working, it would probably matchgulp.cmd
instead of the final executable.
UPDATE: That said, if you want to add some test code, I'm more than happy to try it out and report back to you.
@cowwoc - The module being used under the hood of inspect-process works cross platform.
If it returns the cmd, I should be able to resolve that to use the actual executable instead? I will have to do more digging. I have a Windows VM on my machine, so I should be able to give it a quick look when I have a spare minute.
Or of course, if you wanted to investigate and submit a PR, I would have no objections 😝
@jaridmargolin Yes, as far as I can tell, once you have the path of gulp.cmd
, you can simply invoke bin/gulp
relative to the same directory and it'll work. I checked one other module, and the paths convention seems to be the same (the cmd
always invokes bin/module_name
under the hood).