[Ironruby-core] A few things about system and IO.popen - what's the current status ?

Thibaut Barrère thibaut.barrere at gmail.com
Wed Mar 4 06:37:22 EST 2009


Hi,

sorry if it's a know fact - I could not find the info easily. I hope this
will be useful.

On Windows, system() seems to work partially, is it normal ? The following
works:

>>> system("echo hello")
hello
=> true

the following doesn't seem to (although svn is in the path):

>>> system("svn")
=> false
>>> system("svn.exe")
=> false

Still on Windows, it seems that IO.popen crashes (I had a quick look at
IoOps.cs to see if it was implemented):

>>> IO.popen("svn.exe") do |io| puts io.read end
:0:in `popen': La référence d'objet n'est pas définie à une instance d'un
objet. (System::NullReferenceException)
       from :0:in `popen'
       from :0


I ran the same stuff on Mono and got:

IronRuby 1.0.0.0 on Mono 2.4
Copyright (c) Microsoft Corporation. All rights reserved.

>>> system("blah")
IronRuby.Libraries:0:in `ExecuteProcessAndWait': No such file or directory
(Errno::ENOENT)
from IronRuby.Libraries:0:in `ExecuteCommandInShell'
from :0:in `system'

>>> system("svn")
=> nil
>>> system("svn > svninfo.txt")
=> nil
>>> exit

Finally, running IO.popen on Mono gives the same output as Windows:
IronRuby 1.0.0.0 on Mono 2.4
Copyright (c) Microsoft Corporation. All rights reserved.

>>> IO.popen("svn.exe") { |io| puts io.read }
:0:in `popen': Object reference not set to an instance of an object
(System::NullReferenceException)
from :0:in `popen'


So my question is: what's the current status on system and IO.popen ? Is it
supposed to work and is it a regression, or is it not fully implemented ?

I may be able to help at some point here (either by providing patches or
testing on Mono + Windows) if it's not your top priority :)

Given that I use Ruby to glue things together quite a lot, that would be
useful to me.

cheers,

-- Thibaut
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20090304/8e26b442/attachment.html>


More information about the Ironruby-core mailing list