Ruby Shell
Switch branches/tags
Nothing to show
Clone or download
carview.php?tsp= Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
carview.php?tsp= .bundle
carview.php?tsp= bin
carview.php?tsp= lib
carview.php?tsp= spec
carview.php?tsp= .gitignore
carview.php?tsp= Gemfile
carview.php?tsp= Gemfile.lock
carview.php?tsp= LICENSE.txt
carview.php?tsp= README.html
carview.php?tsp= README.txt
carview.php?tsp= Rakefile
carview.php?tsp= wopen3.gemspec

README.html

<p>Wopen3 is a replacement for Open3. Unlike Open3, Wopen3 does not throw away
the exit code of the executed (grandchild) process. Only a child process is
spawned and the exit status is returned in $? as normal.</p>
<p>Usage example:</p>
<pre>result, errors = '', ''
Wopen3.popen3('git', 'log') do |stdin, stdout, stderr|
  threads = []
  threads &lt;&lt; Thread.new(stdout) do |out|
    out.each { |line| result &lt;&lt; line }
  end
  threads &lt;&lt; Thread.new(stderr) do |err|
    err.each { |line| errors &lt;&lt; line }
  end
  threads.each { |thread| thread.join }
end
status = $?.exitstatus
raise "Non-zero exit status #{status}" if status != 0</pre>
<p>As this is such a common usage pattern, a 'system' method is provided as a
convenience:</p>
<pre>result = Wopen3.system('git', 'log')
result.success? # =&gt; true
result.status   # =&gt; 0
result.stderr   # =&gt; ''
result.stdout   # =&gt; 'commit 491411b3...'</pre>