method
popen3
v1_9_1_378 -
Show latest stable
-
0 notes -
Class: Open3
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378 (0)
- 1_9_2_180 (38)
- 1_9_3_125 (0)
- 1_9_3_392 (0)
- 2_1_10 (36)
- 2_2_9 (0)
- 2_4_6 (0)
- 2_5_5 (0)
- 2_6_3 (0)
- What's this?
popen3(*cmd)
public
Open stdin, stdout, and stderr streams and start external executable. In addition, a thread for waiting the started process is noticed. The thread has a thread variable :pid which is the pid of the started process.
Non-block form:
stdin, stdout, stderr, wait_thr = Open3.popen3(cmd) pid = wait_thr[:pid] # pid of the started process. ... stdin.close # stdin, stdout and stderr should be closed in this form. stdout.close stderr.close exit_status = wait_thr.value # Process::Status object returned.
Block form:
Open3.popen3(cmd) { |stdin, stdout, stderr, wait_thr| ... }
The parameter cmd is passed directly to Kernel#spawn.
wait_thr.value waits the termination of the process. The block form also waits the process when it returns.
Closing stdin, stdout and stderr does not wait the process.