rshim is the shim
program written in rust.
There are several versions of shim
:
-
the official
shim.cs
was written in c# and required an instantiation of a .NET command line app every time it was started therefore is slower than directly executing. And it dose not handle Ctrl+C event correctly. -
shim.c
is ok with performance and Ctrl+C event handling,but sometimes suffer memory violation (randomly exited with return code3221226356
). -
shim.cpp
didn't work on my machine, calling it with any executable result in an infinite recursion of creating subprocess until eating all memory for unknown subtle reason.
- less probability with bug and undefined behavior.
- properly handle variety errors.
- friendly error message.
- properly handle Ctrl+C events.
- properly handle utf-8 with or without bom in shim file.
- relies heavily on Win32 API, moreso than the original
- reduced binary size massively (134KB static compared to 300KB)
- handle quoted strings
- some slight speed improvements
First install rust
cargo build --release
Close any running process with existing shims, then
./repshims.bat
- remove
core::fmt
entirely - make it run with
#![no_std]
- Without
crt-static
enabled: around 48KB - With
crt-static
enabled: around 134KB