Skip to content

Instantly share code, notes, and snippets.

@pskocik
pskocik / shellguard.c
Last active September 6, 2019 21:12
Protect against Ctrl+C and Ctrl-/ not hitting processes backgrounded from shellscripts and leaving them running
/*
NAME:
shellguard
Signal forwarding intermediary command executer that translates terminal-generated SIGINT/SIGQUIT (Ctlr+C/Ctrl+/)
into SIGTERM/SIGABRT so that shell-backgrounded procesess don't stay running in the background when
the user presses Ctrl+C or Ctrl+/.
PROBLEM:
Shell scripts don't kill their child processes and instead rely on process-group-wide signals
@pskocik
pskocik / c.h
Created June 17, 2017 20:34
c.h
#if !__STDC__
# error "< C89"
#endif
#if __STDC_HOSTED__
# include <assert.h>
# include <ctype.h>
# include <errno.h>
# include <float.h>

Keybase proof

I hereby claim:

  • I am pskocik on github.
  • I am pskocik (https://keybase.io/pskocik) on keybase.
  • I have a public key whose fingerprint is 43F1 CFEE 987E 463C 83BE 9219 AE8E 3447 4975 2E35

To claim this, I am signing this object: