execute bash?

Puming via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Apr 8 08:20:09 PDT 2016


On Friday, 8 April 2016 at 13:25:37 UTC, Adam D. Ruppe wrote:
> On Friday, 8 April 2016 at 13:23:10 UTC, Adam D. Ruppe wrote:
>> Odds are it is that there's terminal output for the background 
>> process
>
> NOT a character btw, just any output, then the OS puts you on 
> hold so it can do its thing.
>
> To catch a signal, it is just like in C 
> http://stackoverflow.com/a/35687472/1457000
>
> simplest case:
>
> import core.stdc.signal;
> signal(SIGTTOU, SIG_IGN); // ignore the output thing
>
>
> and see what happens next

I tried with signal, but didn't catch SIGTTOU, it seems that 
spawnProcess with `bash -i -c` will signal with SIGTTIN.

When I catch SIGTTIN with:

  extern(C) void sig_hand(int signal) nothrow @nogc @system {
     import core.stdc.stdio: printf;
     printf("signal %d catched!\n", signal);
  }

I get an infinite loop of

signal 21 catched!
signal 21 catched!
signal 21 catched!

Not sure how to handle that. Maybe I can't use `bash -i`.



More information about the Digitalmars-d-learn mailing list