unbewusst.sein
9/3/2008 12:23:00 PM
I'm trying some samples of open4-0.9.6 :
------------------------------------------------------------------------
#! /usr/bin/env ruby
require 'rubygems'
require 'open4'
include Open4
cat = 'ruby -e" ARGF.each{|line| STDOUT << line} "'
stdout, stderr = '', ''
status = spawn cat, 'stdin' => '42', 'stdout' => stdout, 'stderr' =>
stderr
p status
p stdout
p stderr
stdout, stderr = '', ''
status = spawn cat, 0=>'42', 1=>stdout, 2=>stderr
p status
p stdout
p stderr
------------------------------------------------------------------------
I've just added the shebang and "require 'rubygems'" to the original
file.
When running it, i get :
../spawn.rb:10: undefined method `spawn' for main:Object (NoMethodError)
seems strange to me because the method spawn IS defined in the "module
Open4" (lines 241-320)
any idea ?
--
Une Bévue