List Info

Thread: Make it possible to read process exit status




Make it possible to read process exit status
user name
2006-04-23 17:50:35
Patches item #4121, was opened at 2006-04-16 12:07
You can respond by visiting: 
http://rubyforge.org/tracker/
?func=detail&atid=413&aid=4121&group_id=85

Category: win32-open3
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Samuel Tesla (stesla)
Assigned to: Nobody (None)
Summary: Make it possible to read process exit status

Initial Comment:
The UNIX Open3 sets the global $? to a Process::Status
object so that one can read the exit status of the sub
process.

It seems that one is not supposed to fiddle with /that/
variable, but we can make our own.  This patch adds a
#last_status method to both the Open3 and Open4 modules that
returns a Process::Status object that is set when the pipes
are closed (similarly to how Ruby does it in io.c).

I also made popen3 and popen4 return the object when
they're called with a block.  I figured it was as neat
idea.

------------------------------------------------------------
----------

>Comment By: Samuel Tesla (stesla)
Date: 2006-04-23 12:50

Message:
I figured out how to get to the global that $? reads from,
so this new patch makes win32-open3 pretty much behave
exactly like the unix open3.

------------------------------------------------------------
----------

Comment By: Samuel Tesla (stesla)
Date: 2006-04-17 17:57

Message:
One thing to note.  My C-foo on windows isn't the greatest.

There /is/ a global variable in process.c called
rb_last_status which is what is hooked up to $?.  In io.c
and eval.c that variable is used as an extern.  I don't
know
if you can get to that from a DLL.  I tried just doing
"extern VALUE rb_last_status" but always got a
blow-up when
I assigned to it.  If there's some way to declare it so
that
we can get to it from inside the module, that would probably
be better than #last_status.

------------------------------------------------------------
----------

You can respond by visiting: 
http://rubyforge.org/tracker/
?func=detail&atid=413&aid=4121&group_id=85
_______________________________________________
win32utils-devel mailing list
win32utils-develrubyforge.org
http://rubyforge.org/mailman/listinfo/win32utils-devel

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )