Skip to content

Instantly share code, notes, and snippets.

@wilbowma
Last active April 14, 2021 06:37
Show Gist options
  • Save wilbowma/f6d3eeb1a49aa88aed1b51f7897c1c51 to your computer and use it in GitHub Desktop.
Save wilbowma/f6d3eeb1a49aa88aed1b51f7897c1c51 to your computer and use it in GitHub Desktop.
#lang racket
;; Run like: racket -t meow.rkt; pgrep -a racket
;; Welcome to Racket v8.0.0.11 [cs].
(require
racket/engine
rackunit)
(define exe-path (find-executable-path "racket"))
(define (doit)
(parameterize ([current-subprocess-custodian-mode 'kill])
(let ([e (engine (lambda (_)
(system*/exit-code
exe-path
"-e"
"((lambda (x) (x x)) (lambda (x) (x x)))")))])
(if (engine-run 1000 e)
(void)
(begin
(displayln "Timed out"))))))
;; When uncommented, this process terminates when "meow.rkt" terminates.
#;(doit)
;; When uncommented, this process terminates does NOT terminate the subprocess when "meow.rkt" terminates.
(test-case "" (doit))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment