Skip to content

Commit

Permalink
Save exit code
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Applencourt committed Oct 1, 2024
1 parent 1d23af6 commit bcda3e1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions xprof/xprof.rb.in
Original file line number Diff line number Diff line change
Expand Up @@ -423,14 +423,17 @@ def launch_usr_bin(env, cmd)

begin
PTY.spawn(bash_env, *cmd) do |stdout, _stdin, _pid|
# Reading stdout will trigger Errno::EIO
stdout.each { |line| print line }
rescue Errno::EIO
# Wait for the PTY to finish, to set $?
Process.wait(_pid)
$?
end
# Not sure how this exception can be triggered
rescue PTY::ChildExited
LOGGER.warn { 'Application Exited' }
rescue Interrupt
LOGGER.warn { 'Application Received Interrupt Signal' }
#SigINT is 2
2
rescue Errno::ENOENT
warn("#{__FILE__}: Can't find executable #{cmd.first}")
raise Errno::ENOENT
Expand Down

0 comments on commit bcda3e1

Please sign in to comment.