Open mihab opened 6 years ago
How about executing with the .cmd
extension?
$ winpty mvn.cmd
Yes it does work, thanks! Can someone explain why mvn.cmd works but mvn and mvn.exe don't?
Under cygwin, the same behavior occurs with node.js components npm
and npx
.
Also node packages such as serialport
with standalone commands:
$ which serialport-list
/cygdrive/c/Users/admin/AppData/Roaming/npm/serialport-list
$ ls /cygdrive/c/Users/admin/AppData/Roaming/npm
create-react-app ng nodemon node-red-pi.cmd serialport-list serialport-term.cmd
create-react-app.cmd ng.cmd nodemon.cmd npm-windows-upgrade serialport-list.cmd yo
electron node_modules node-red npm-windows-upgrade.cmd serialport-repl yo.cmd
electron.cmd node-gyp node-red.cmd reddit-oauth-helper serialport-repl.cmd yo-complete
etc node-gyp.cmd node-red-pi reddit-oauth-helper.cmd serialport-term yo-complete.cmd
$ serialport-list
COM1 ACPI\PNP0501\1 (Standard port types)
$ winpty serialport-list
winpty: error: cannot start 'serialport-list': Not found in PATH
code 1
$ winpty serialport-list.cmd
COM1 ACPI\PNP0501\1 (Standard port types)
@mihab Yes it does work, thanks! Can someone explain why mvn.cmd works but mvn and mvn.exe don't?
There's probably no mvn.exe
in your PATH directories, and winpty
explicitly appends .exe
to the program name when searching:
if (endsWith(candidate, ".bat") || endsWith(candidate, ".cmd")) {
#ifdef __MSYS__
// In MSYS/MSYS2, batch files don't have the execute bit
// set, so just check that they're readable.
perm = R_OK;
#endif
} else if (endsWith(candidate, ".com") || endsWith(candidate, ".exe")) {
// Do nothing.
} else {
// Make the exe extension explicit so that we don't try to
// run shell scripts with CreateProcess/winpty_spawn.
candidate += ".exe";
}
I see, thanks for the explanation. It's still kinda weird behaviour and perhaps not so intuitive, what do you think should be done about this ticket @wulph111 ? Close as a non-bug?
I'd leave it open for @rprichard to decide.. it's confusing behavior but maybe necessary. I don't know enough to say if it can be "fixed" -- I'm only here because I had the same problem :)
Shouldn't winpty respect the PATH_EXT environment variable?
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PY
What's this? After managing aliases permission denied got resolved but now this ? winpty : Not found in PATH ?
A bit silly, but does anyone know what is going on here:
miha@DESKTOP-CEC4TIT MINGW64 ~ $ mvn --version Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T09:58:13+02:00) Maven home: C:\Users\miha\Dev\maven\3.5.2 Java version: 1.8.0_161, vendor: Oracle Corporation Java home: C:\Program Files\Java\jdk1.8.0_161\jre Default locale: en_US, platform encoding: Cp1252 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
miha@DESKTOP-CEC4TIT MINGW64 ~ $ winpty mvn --version winpty: error: cannot start 'mvn': Not found in PATH
miha@DESKTOP-CEC4TIT MINGW64 ~ $ winpty which mvn /c/Users/miha/Dev/maven/3.5.2/bin/mvn
Quite obviously mvn is on the path, works with Command Prompt and Git Bash (but cannot be interrupted), but when used via winpty it's apparently not on the path? Does winpty use a different path variable or something?