Re: [racket-users] ‘with-limits’ doesn’t stop subprocesses

2018-08-05 Thread Matthew Flatt
I must have tried it wrong the first time, because I see what you see. I'm surprised that `with-limits` doesn't shut down a custodian on a timeout, but you can set up that termination yourself: (parameterize ([current-subprocess-custodian-mode 'kill] [current-custodian

[racket-users] ‘with-limits’ doesn’t stop subprocesses

2018-08-05 Thread 'Leandro Facchinetti' via Racket Users
Hi, I want to run a subprocess with a timeout. Here’s what I tried: #lang racket (require racket/sandbox) (with-handlers ([exn:fail:resource? (λ (e) (displayln "Timed out"))]) (with-limits 5 #f (system "sleep 10 && echo Finished"))) This doesn’t work, it prints both “Timed out” after 5

Re: [racket-users] ‘with-limits’ doesn’t stop subprocesses

2018-08-05 Thread Matthew Flatt
At Fri, 20 Jul 2018 16:28:22 -0400, "'Leandro Facchinetti' via Racket Users" wrote: > Hi, > > I want to run a subprocess with a timeout. Here’s what I tried: > > #lang racket > (require racket/sandbox) > > (with-handlers ([exn:fail:resource? (λ (e) (displayln "Timed out"))]) > (with-limits 5

Re: [racket-users] ‘with-limits’ doesn’t stop subprocesses

2018-08-05 Thread Philip McGrath
I thought `current-subprocess-custodian-mode` would be the solution, but when I just tried your code (with Racket 6.12 on Mac OS), it first printed "Timed out", then printed “Finished” after a brief delay. I get the same result if I put the `parameterize` directly around the call to `system`, and