I'm writing a handful of tools that I'd like to on Windows. They're generally "command shims", i.e. they do some work once and then execute another program using one of the functions in the exec
family in Unix.
An example would be setting a bunch of environment variables like shush. It can be used like:
export KMS_ENCRYPTED_MOO=<base64str...>
shush exec -- env
The shush
program iterates over env vars, decrypts variables that have the prefix KMS_ENCRYPTED_
using AWS KMS and sets new environment variables (sans prefix) with the decrypted value before continuing execution of the env
program.
How can I do this on Windows? My understanding is that Windows' CreateProcess
function is equivalent to a fused fork
and exec
pair on *nix, but I only want the functionality of the latter. I know I could create a child process and forward stdin, stdout and stderr to the child process, but then I'd also have to handle whatever Windows' equivalent of signals are and that seems fraught with danger for a novice like me.