From: 0xfffffff0@... Date: 2020-05-15T20:26:47+00:00 Subject: [ruby-core:98392] [Ruby master Feature#16791] Shortcut for Process::Status.exitstatus Issue #16791 has been updated by 0x81000000 (/ /). Dan0042 (Daniel DeLorme) wrote in #note-6: > `exec` only works as a tail-call at the end of the script. Most of the time it's not applicable: > ```ruby > system(cmd1) or exit($?.exitstatus) > system(cmd2) or exit($?.exitstatus) > system(cmd3) or exit($?.exitstatus) > ``` ``` ruby exec 'cmd1 && cmd2 && cmd3' ``` ---------------------------------------- Feature #16791: Shortcut for Process::Status.exitstatus https://bugs.ruby-lang.org/issues/16791#change-85660 * 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: