Bug #1690
closed
backticks don't set $? in windows
Added by rogerdpack (Roger Pack) over 15 years ago.
Updated over 13 years ago.
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
- Status changed from Open to Assigned
- Assignee set to usa (Usaku NAKAMURA)
- Target version set to 1.9.2
- 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
=begin
That's fine, though surprises me that backticks set $? on linux but not windows.
=r
=end
=begin
On Mon, Jul 13, 2009 at 4:46 PM, Roger Packredmine@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?
--
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
=begin
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,¶
U.Nakamura usa@garbagecollect.jp
=end
=begin
Perhaps we could at least set
$?
to nil after running system()? [so that it's more obvious that this discrepancy exists]?
=end
Also available in: Atom
PDF
Like0
Like0Like0Like0Like0Like0Like0