-
-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows shims show Terminate batch job (Y/N)?
on ctrl-c
#269
Comments
Current viable workarounds:
doskey /exename=cmd.exe npx=proto run node --bin npx.cmd -- $*
function node { proto run node -- @args }
proto.exe run node -- %* & EXIT |
I don't know windows very well, is the |
I don't know Windows very well either. I think these are all limited workarounds, and that the best way to handle this is to not use The Windows itself has some facility for shell aliases under Settings -> Apps -> Advanced app settings -> App execution aliases, which seem to get installed to But it looks like a lot of platform-specific stuff that may or may not be worth it, and is not as user-hackable as shims. |
I've come up with an even better way of suppressing the prompt. It's ugly and I hate it, but it seems pretty effective: setlocal enabledelayedexpansion
proto.exe run node -- %* & set RC=!errorlevel! & call;
EXIT /b %RC% On ctrl-c, the errorlevel gets set, but not immediately. That is, when doing
even though the return code of EDIT: this misbehaves with |
Figured this out here #308 |
I have my doubts that script-based shims can overcome all the idiosyncrasies of cmd and PowerShell. That said, if anyone can make it work, you can! |
Actually stole it from here: pnpm/cmd-shim#39 Looks like npm/pnpm/yarn are starting to use it too. |
Ok out. |
None of these are quite dealbreakers but here are issues I currently attribute to the use of shims:
Awesome! I tried out the fix and it definitely fixes this issue (and I think also fixes the more annoying bug where a node subprocess/server will stay alive after interrupting the parent). |
This is expected. Shims will dynamically change versions, while the exe is manually pinned to a version. We can't make the exe dynamic, so if you don't want the dynamic part, just don't use the shims in
Do you have .ps1 in your |
In the long run, I want to ditch ps1/cmd shims, and somehow generate .exe files on demand. They would be simple wrappers for spawning a child process. I'm pretty sure this is how chocolatey works. |
It's the opposite - I do want the executable to be dynamic. But
Whether or not I put |
You could move the proto binary somewhere else and just ignore that path.
Why is windows so dumb 😢 |
I plan to remove that path from my
I bet it's because this way MS didn't have to worry about name collisions between Cmdlets and the pre-existing morass of executables and WSH scripts. Fun fact: when you say "pwsh" out loud, it's a fair approximation of the sound you get when you break windows! |
The registry entry didn't work great. Wound up moving the executable to the shims folder and dropping the bin folder from my |
What version?
0.21.0
Which command?
No response
What happened?
When launching a shim on Windows, interrupting with ctrl-c can result in the confusing output "Terminate batch job (Y/N)?".
To reproduce:
and stop the program with ctrl c.
Any logs?
No response
Operating system?
Windows
Architecture?
x64
The text was updated successfully, but these errors were encountered: