Skip to content

Commit

Permalink
Use #exit_signal? in stdlib
Browse files Browse the repository at this point in the history
  • Loading branch information
straight-shoota committed Dec 17, 2024
1 parent 27b081b commit ec05412
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
3 changes: 1 addition & 2 deletions src/compiler/crystal/command.cr
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,7 @@ class Crystal::Command
private def exit_message(status)
case status.exit_reason
when .aborted?, .session_ended?, .terminal_disconnected?
if status.signal_exit?
signal = status.exit_signal
if signal = status.exit_signal?
if signal.kill?
"Program was killed"
else
Expand Down
20 changes: 9 additions & 11 deletions src/process/status.cr
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,10 @@ class Process::Status
{% if flag?(:win32) %}
@exit_status.to_s(io)
{% else %}
if normal_exit?
exit_code.inspect(io)
if signal = exit_signal?
signal.inspect(io)
else
exit_signal.inspect(io)
exit_code.inspect(io)
end
{% end %}
io << "]"
Expand All @@ -309,15 +309,14 @@ class Process::Status
{% if flag?(:win32) %}
@exit_status.to_s(io)
{% else %}
if normal_exit?
io << exit_code
else
signal = exit_signal
if signal = exit_signal?
if name = signal.member_name
io << name
else
signal.inspect(io)
end
else
io << exit_code
end
{% end %}
end
Expand All @@ -330,11 +329,10 @@ class Process::Status
{% if flag?(:win32) %}
@exit_status.to_s
{% else %}
if normal_exit?
exit_code.to_s
else
signal = exit_signal
if signal = exit_signal?
signal.member_name || signal.inspect
else
exit_code.to_s
end
{% end %}
end
Expand Down

0 comments on commit ec05412

Please sign in to comment.