Forum: Ruby-core [Bug #1690] backticks don't set $? in windows

Posted by Roger Pack (Guest)
on 2009-06-25 15:26
(Received via mailing list)
Bug #1690: backticks don't set $? in windows
http://redmine.ruby-lang.org/issues/show/1690

Author: Roger Pack
Status: Open, Priority: Normal
ruby -v: trunk

currently

>> `bad command`
Errno::ENOENT: No such file or directory - bad
        from (irb):1:in ``'
        from (irb):1
        from C:/installs/ruby_trunk_installed/bin/irb.bat:20:in `<main>'
>> $?
=> nil

Thanks.

>ruby -v
ruby 1.9.2dev (2009-05-25 trunk 23567) [i386-mingw32]
Posted by Usaku NAKAMURA (Guest)
on 2009-07-13 15:25
(Received via mailing list)
Issue #1690 has been updated by Usaku NAKAMURA.

Status changed from Assigned to Rejected

This is spec.
Ruby doesn't execute any child process in such case on Windows, so, ruby 
cannot set any status to $?.
----------------------------------------
http://redmine.ruby-lang.org/issues/show/1690
Posted by Roger Pack (Guest)
on 2009-07-13 21:47
(Received via mailing list)
Issue #1690 has been updated by Roger Pack.


That's fine, though surprises me that backticks set $? on linux but not 
windows.
=r
----------------------------------------
http://redmine.ruby-lang.org/issues/show/1690
Posted by Luis Lavena (luislavena)
on 2009-07-13 23:12
(Received via mailing list)
On Mon, Jul 13, 2009 at 4:46 PM, Roger Pack<redmine@ruby-lang.org> 
wrote:
> Issue #1690 has been updated by Roger Pack.
>
>
> That's fine, though surprises me that backticks set $? on linux but not windows.

Last year we provided a patch for backticks and system to properly
find "rake" instead of "rake.bat" and properly set the exited process
information that was missing.

Is a Windows limitation about the exited process or is Ruby itself
that lacks the tracking of it?
Posted by U.Nakamura (Guest)
on 2009-07-14 02:16
(Received via mailing list)
Hello,

In message "[ruby-core:24317] [Bug #1690] backticks don't set $? in 
windows"
    on Jul.14,2009 04:46:26, <redmine@ruby-lang.org> wrote:
> Issue #1690 has been updated by Roger Pack.
> 
> That's fine, though surprises me that backticks set $? on linux but not windows.

On Linux, ruby forks itself first, and the child ruby process
executes the target command.
So, if the target command is missing, the child ruby returns
some error status, and the parent ruby gets it.

IMO, in this case, mswin's behavior of $? is better than Linux's.


Regards,
Posted by Roger Pack (Guest)
on 2009-08-24 07:28
(Received via mailing list)
Issue #1690 has been updated by Roger Pack.


Perhaps we could at least set
 $?
to nil after running system()? [so that it's more obvious that this 
discrepancy exists]?
----------------------------------------
http://redmine.ruby-lang.org/issues/show/1690
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.