Project

General

Profile

Actions

Bug #1690

closed

backticks don't set $? in windows

Added by rogerdpack (Roger Pack) almost 15 years ago. Updated almost 13 years ago.

Status:
Rejected
Target version:
ruby -v:
trunk
Backport:
[ruby-core:24032]

Description

=begin
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 `'
$?
=> nil

Thanks.

ruby -v
ruby 1.9.2dev (2009-05-25 trunk 23567) [i386-mingw32]
=end

Actions #1

Updated by yugui (Yuki Sonoda) almost 15 years ago

  • Status changed from Open to Assigned
  • Assignee set to usa (Usaku NAKAMURA)
  • Target version set to 1.9.2

=begin

=end

Actions #2

Updated by usa (Usaku NAKAMURA) almost 15 years ago

  • Status changed from Assigned to Rejected

=begin
This is spec.
Ruby doesn't execute any child process in such case on Windows, so, ruby cannot set any status to $?.
=end

Actions #3

Updated by rogerdpack (Roger Pack) almost 15 years ago

=begin
That's fine, though surprises me that backticks set $? on linux but not windows.
=r
=end

Actions #4

Updated by luislavena (Luis Lavena) almost 15 years ago

=begin
On Mon, Jul 13, 2009 at 4:46 PM, Roger Pack 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?

--
Luis Lavena
AREA 17

Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry

=end

Actions #5

Updated by usa (Usaku NAKAMURA) almost 15 years ago

=begin
Hello,

In message "[ruby-core:24317] [Bug #1690] backticks don't set $? in windows"
on Jul.14,2009 04:46:26, 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,

U.Nakamura

=end

Actions #6

Updated by rogerdpack (Roger Pack) over 14 years ago

=begin
Perhaps we could at least set
$?
to nil after running system()? [so that it's more obvious that this discrepancy exists]?
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0