Fork and exec

Thanks Nobu, this makes sense.


-----Original Message-----
From: []
Sent: Wednesday, October 16, 2002 10:22 PM
Subject: Re: fork and exec


At Thu, 17 Oct 2002 08:26:09 +0900, Meng, Ted wrote:

system “mkfifo ttt”
pid = fork
exec (“cat < ttt”) if pid.nil?

exec (“exec cat < ttt”) if pid.nil?

I would expect only one process the real “cat process”, but apparently,
a process and then a child process, which is the real one.

When you use redirection, ruby invokes /bin/sh and /bin/sh
forks to execute the command.

Nobu Nakada