Open akfish opened 10 years ago
I did some more testing and found the cause.
In Windows, node creates a *.cmd
file in %USERPROFILE%\AppData\Roaming\npm
for each global module command. While the native cmd.exe doesn't need the file extension to find the command, the child_proccess.spawn
does.
So to get those commands listed above working, just add the file extensions:
Though it's nice to fix this or at least document it.
I will fix it next week, I don't have Windows machine at home.
I'm not sure what's the best way to resolve this issue. At first I thought I would just add .cmd at the end if the command isn't found, but that is really lame. Probing seems like a bad idea in the first place and there might be other extensions like .bat that wouldn't work either.
There is one workaround though, you can start web-terminal with -h (--shell) option, like this:
$ web-terminal -h cmd
Do you have any better ideas?
I would try to emulate what the cmd does:
PATH
environment variablePATH
is to give users the ability to config search paths or command white-list/alias-list in config files. @rabchev Check out this package: https://www.npmjs.org/package/which Found it when working on another project. It should do the trick.
Environment Windows 10 x64 Node 10.x
Following up on this thread, some commands are not recognized, such as 'npm', 'dir', 'ls', 'start'.
Environment
Steps
web-terminal
in cmd.exelocalhost:8088/terminal/
in browser[command name]: command not found
.Commands that run perfectly in a native terminal but won't work with web terminal:
One thing they have in common is that they are all commands of globally installed node modules.