Let child set itself to foreground
Let child set itself to foreground

The previous implementation fork and exec the command
before the parent put the job to foreground. This can
introduce signal problems, for example in the pipe

cat | cat | cat | cat

the first cat process may already start running before
the entire pipe is created. But at this time the job is
still in the background, thus the cat would receive SIGTTOU
as it reads stdin.

We now only do fork, not exec, and let the first forked child
process set its own process group to the foreground. Then the
child exec the command.

pjhades/rubbish