Forward exit code
This commit is contained in:
parent
2eb551da4c
commit
cab2c74251
@ -125,6 +125,8 @@ $control_socket.puts "ready"
|
|||||||
|
|
||||||
read_ios = [$control_socket, $stdin, pipes["stdout"], pipes["stderr"]]
|
read_ios = [$control_socket, $stdin, pipes["stdout"], pipes["stderr"]]
|
||||||
|
|
||||||
|
exit_code = "unknown"
|
||||||
|
|
||||||
while read_ios.include?($control_socket) or read_ios.include?(pipes["stdout"]) or read_ios.include?(pipes["stderr"])
|
while read_ios.include?($control_socket) or read_ios.include?(pipes["stdout"]) or read_ios.include?(pipes["stderr"])
|
||||||
log "trace", read_ios.inspect
|
log "trace", read_ios.inspect
|
||||||
|
|
||||||
@ -150,6 +152,10 @@ while read_ios.include?($control_socket) or read_ios.include?(pipes["stdout"]) o
|
|||||||
if command != "done"
|
if command != "done"
|
||||||
log "error", "malformed response from github-fast-envd"
|
log "error", "malformed response from github-fast-envd"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if !arguments.empty?
|
||||||
|
exit_code = arguments[0]
|
||||||
|
end
|
||||||
else
|
else
|
||||||
log "warn", "received input from unknown stream"
|
log "warn", "received input from unknown stream"
|
||||||
end
|
end
|
||||||
@ -161,3 +167,9 @@ while read_ios.include?($control_socket) or read_ios.include?(pipes["stdout"]) o
|
|||||||
|
|
||||||
read_ios = read_ios.select {|x| not x.closed?}
|
read_ios = read_ios.select {|x| not x.closed?}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
exit_code_is_numeric = Integer(exit_code) != nil rescue false
|
||||||
|
|
||||||
|
if exit_code_is_numeric
|
||||||
|
exit Integer(exit_code)
|
||||||
|
end
|
||||||
|
@ -109,6 +109,8 @@ while true
|
|||||||
original_stdout = $stdout.dup
|
original_stdout = $stdout.dup
|
||||||
original_stderr = $stderr.dup
|
original_stderr = $stderr.dup
|
||||||
|
|
||||||
|
exit_code = "unknown"
|
||||||
|
|
||||||
begin
|
begin
|
||||||
stdin = open_pipe(connection_id, "stdin")
|
stdin = open_pipe(connection_id, "stdin")
|
||||||
control_socket.puts "stdin #{stdin}"
|
control_socket.puts "stdin #{stdin}"
|
||||||
@ -145,6 +147,9 @@ while true
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
load script_path, true
|
load script_path, true
|
||||||
|
rescue SystemExit => error
|
||||||
|
original_stderr.puts " exit code: #{error.status}"
|
||||||
|
exit_code = error.status
|
||||||
rescue => error
|
rescue => error
|
||||||
$stdin = original_stdin
|
$stdin = original_stdin
|
||||||
$stdout = original_stdout
|
$stdout = original_stdout
|
||||||
@ -176,7 +181,7 @@ while true
|
|||||||
end
|
end
|
||||||
|
|
||||||
begin
|
begin
|
||||||
control_socket.puts "done"
|
control_socket.puts "done #{exit_code}"
|
||||||
rescue
|
rescue
|
||||||
end
|
end
|
||||||
control_socket.close
|
control_socket.close
|
||||||
|
Loading…
Reference in New Issue
Block a user