From: nobu.nokada@... Date: 2003-07-16T04:50:00+09:00 Subject: Re: system, `` or exec on Windows? Hi, At Tue, 15 Jul 2003 17:46:31 +0900, Ronald Pijnacker wrote: > - execute a child process > - get the output written to stdout and stderr (as with ``) > - also get the exit code ($?) > - in a thread safe way If you run on NT, IO.popen("your-command 2>&1") {|f| output = f.read exitcode = Process.waitpid2(f.pid)[1] } > On unix I would probably revert to using a pipe, fork and waitpid2. > However, fork does not seem to be available (understandably) on Windows. > Any other options I missed? I'd like to add arguments specifying redirection to system, popen etc. for portability, but don't have nice notation yet. > Is $? thread safe? Yes. $? is a thread local variable. -- Nobu Nakada