Open4 : undefined method `spawn'

U

Une Bévue

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 ?
 
A

ara.t.howard

I'm trying some samples of open4-0.9.6 :

= ------------------------------------------------------------------------
#! /usr/bin/env ruby

require 'rubygems'
require 'open4'
include Open4

cat =3D 'ruby -e" ARGF.each{|line| STDOUT << line} "'

stdout, stderr =3D '', ''
status =3D spawn cat, 'stdin' =3D> '42', 'stdout' =3D> stdout, = 'stderr' =3D>
stderr
p status
p stdout
p stderr

stdout, stderr =3D '', ''
status =3D spawn cat, 0=3D>'42', 1=3D>stdout, 2=3D>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 =20
(NoMethodError)

seems strange to me because the method spawn IS defined in the "module
Open4" (lines 241-320)

any idea ?
--=20
Une B=E9vue


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 =20
spawn "echo 42", :stdout =3D> STDOUT and p Open4.version '
42
"0.9.6"




a @ http://codeforpeople.com/
 
A

Axel Etzold

-------- Original-Nachricht --------
Datum: Thu, 4 Sep 2008 04:42:56 +0900
Von: "ara.t.howard" <[email protected]>
An: (e-mail address removed)
Betreff: Re: Open4 : undefined method `spawn\'


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/

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
 
A

ara.t.howard

Hi ---

what platform are you on ?
osx.



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



all the distros, including osx and ubuntu completely hose ruby. that
includes redhat enterprise, etc, etc. i always build ruby from src:

./configure --prefix=/usr/local/ && make && sudo make install

even on windows (using msys) this has been my preferred method of
installing ruby. i too have heard of issues with ubuntu.

sorry i can't be of more help.

cheers.


a @ http://codeforpeople.com/
 
U

Une Bévue

Axel Etzold said:
what platform are you on ?

MacOS X 10.4.11
ruby 1.8.6 (2007-09-24 patchlevel 111) [powerpc-darwin8.11.0]
MacPorts install (under /opt/local)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

[ANN] open4-0.9.2 0
[ANN] open4-0.9.0 0
[ANN] open4-0.8.0 2
[ANN] open4-0.6.0 0
[ANN] open4-0.5.1 0
[ANN] open4-0.5.0 0
open4 stdin.close required? 0
[ANN] open4-0.7.0 0

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,165
Latest member
JavierBrak
Top