Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.ruby > #2534
| From | Brian Candler <b.candler@pobox.com> |
|---|---|
| Newsgroups | comp.lang.ruby |
| Subject | Re: How do I trap Ctrl-C so it doesn't reach spawned threads? |
| Date | 2011-04-08 08:38 -0500 |
| Organization | Service de news de lacave.net |
| Message-ID | <e0177039200de04e1b0cfb868aa1bd00@ruby-forum.com> (permalink) |
| References | <33CD3794F54FDD4BB58A738E6EFCADC3150FE0EFB7@ESESSCMS0363.eemea.ericsson.se> |
> 3. Anyone with a suggestion how to spawn processes not affected by a
> SIGINT?
Try replacing
Thread.new { system("...") }
with:
fork { Process.setsid; exec("...") }
This also has the advantages of:
- not using threads
- the pid of the child is the return value from fork
Regards,
Brian.
--
Posted via http://www.ruby-forum.com/.
Back to comp.lang.ruby | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How do I trap Ctrl-C so it doesn't reach spawned threads? Jens Carlberg <jens.carlberg@ericsson.com> - 2011-04-08 02:53 -0500
Re: How do I trap Ctrl-C so it doesn't reach spawned threads? Brian Candler <b.candler@pobox.com> - 2011-04-08 08:38 -0500
Re: How do I trap Ctrl-C so it doesn't reach spawned threads? Charles Oliver Nutter <headius@headius.com> - 2011-04-10 18:32 -0500
Re: How do I trap Ctrl-C so it doesn't reach spawned threads? Charles Oliver Nutter <headius@headius.com> - 2011-04-19 17:45 -0500
csiph-web