From: Axel Etzold Date: 2008-09-04T05:10:24+09:00 Subject: Re: Open4 : undefined method `spawn' -------- Original-Nachricht -------- > Datum: Thu, 4 Sep 2008 04:42:56 +0900 > Von: "ara.t.howard" > An: ruby-talk@ruby-lang.org > Betreff: Re: Open4 : undefined method `spawn\' > > On Sep 3, 2008, at 6:19 AM, Une B�vue wrote: > > > 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 > > > > > it does seems strange. for me: > > cfp:~ > sudo gem install open4 > Successfully installed open4-0.9.6 > 1 gem installed > > > > cfp:~ > ruby -r rubygems -e' require "open4" and include Open4 and > spawn "echo 42", :stdout => STDOUT and p Open4.version ' > 42 > "0.9.6" > > > > > a @ http://codeforpeople.com/ > -- > we can deny everything, except that we have the possibility of being > better. simply reflect on that. > h.h. the 14th dalai lama > > > Hi --- what platform are you on ? I tried the code you posted and it works fine on my Ubuntu box. That said, I came across some quite mysterious errors on previous installs of various gems, sent some mails to this and other lists, where the authors said, "I've just tried the software on a fresh install of Ubuntu, and it works." Then I freshly installed Ubuntu, and it worked..... never found out what the error was .. presumably some path issue with ruby installed in multiple ways ... Just guessing ... Best regards, Axel -- Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten Browser-Versionen downloaden: http://www.gmx.net/de/go/browser