[ruby-core:98129] [Ruby master Feature#16791] Shortcut for Process::Status.exitstatus
From:
0xfffffff0@...
Date:
2020-05-03 22:16:45 UTC
List:
ruby-core #98129
Issue #16791 has been updated by 0x81000000 (/ /).
nobu (Nobuyoshi Nakada) wrote in #note-4:
> Even `exec` works better than `system` & `exit`, unless you need some clean-ups.
You're right. What can you say about this 'vararg require':
```
module Kernel
alias :require_1 :require
def require p, *a
return require_1 p if a.empty?
a.unshift p
a.map { | s | require_1 s }
end
end
```
Could this break backward compatibility?
----------------------------------------
Feature #16791: Shortcut for Process::Status.exitstatus
https://bugs.ruby-lang.org/issues/16791#change-85372
* Author: 0x81000000 (/ /)
* Status: Open
* Priority: Normal
----------------------------------------
[Updated]
```
s = `csc x.cs`.sub(/.*?\n\n/m, '')
puts s if s != ''; exit $?.exitstatus if $?.exitstatus > 0
system 'mono x.exe'; exit $?.exitstatus
```
```
class Process::Status
alias :es :exitstatus
end
```
```
s = `csc x.cs`.sub(/.*?\n\n/m, '')
puts s if s != ''; exit $?.es if $?.es > 0
system 'mono x.exe'; exit $?.es
```
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>