Scoop, although very useful and nice to use,
uses a (subjectively) terrible shim.exe
file to redirect commands from scoop\shims\app.exe
to scoop\apps\app\current\app.exe
, because:
- It's made in C#, and thus requires an instantiation of a .NET command line app everytime it is started, which can make a command run much slower than if it had been ran directly;
- It does not handle Ctrl+C and other signals correctly, which can be quite infuriating.
The last issue making interaction with REPLs and long-running apps practically impossible, and having never been fixed, I set out to improve them with this repository.
shim.cpp
is:
- Faster, because it does not use the .NET Framework, and parses the
.shim
file in a simpler way. - More efficient, because by the time the target of the shim is started, all allocated memory will have been freed.
- And more importantly, it works better:
- Signals originating from pressing
Ctrl+C
are ignored, and therefore handled directly by the spawned child. Your processes and REPLs will no longer close when pressingCtrl+C
. - Children are automatically killed when the shim process is killed. No more orphaned processes and weird behaviors.
- Signals originating from pressing
Note: This project is not affiliated with Scoop.
Installation
- In a Visual Studio command prompt, run
cl /O1 shim.c
. - Or using
clang++
withclang++ shim.cpp -o shim.exe -m32 -O -std=c++17 -g
. - Replace any
.exe
inscoop\shims
byshim.exe
.
An additional script, repshims.bat
, is provided. It will replace all .exe
s in the user's Scoop directory
by shim.exe
.
License
SPDX-License-Identifier: MIT OR Unlicense