Skip to content

Commit

Permalink
Fix uses of .exit_status to prefer .exit_code.
Browse files Browse the repository at this point in the history
It turns out that `.exit_status` is not correct. We want `.exit_code`.
See discussion here: crystal-lang/crystal#8381
  • Loading branch information
jemc committed Aug 6, 2021
1 parent 2154d8c commit 97b7792
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/savi/compiler/binary.cr
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ class Savi::Compiler::Binary
link_args << "-o" << ctx.options.binary_name

res = Process.run("/usr/bin/env", link_args, output: STDOUT, error: STDERR)
raise "linker failed" unless res.exit_status == 0
raise "linker failed" unless res.exit_code == 0

if ctx.options.release
res = Process.run("/usr/bin/env", ["strip", ctx.options.binary_name], output: STDOUT, error: STDERR)
raise "strip failed" unless res.exit_status == 0
raise "strip failed" unless res.exit_code == 0
end
ensure
File.delete(obj_filename) if obj_filename
Expand Down
6 changes: 3 additions & 3 deletions src/savi/compiler/binary_verona.cr
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,18 @@ class Savi::Compiler::BinaryVerona
link_args << "-o" << ctx.options.binary_name

res = Process.run("/usr/bin/env", link_args, output: STDOUT, error: STDERR)
raise "linker failed" unless res.exit_status == 0
raise "linker failed" unless res.exit_code == 0

if ctx.options.release
res = Process.run("/usr/bin/env", ["strip", ctx.options.binary_name], output: STDOUT, error: STDERR)
raise "strip failed" unless res.exit_status == 0
raise "strip failed" unless res.exit_code == 0
end
ensure
File.delete(obj_filename) if obj_filename
end

def self.run_last_compiled_program
res = Process.run("/usr/bin/env", ["./" + Compiler::CompilerOptions::DEFAULT_BINARY_NAME], output: STDOUT, error: STDERR)
res.exit_status
res.exit_code
end
end
2 changes: 1 addition & 1 deletion src/savi/compiler/eval.cr
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ class Savi::Compiler::Eval
binary_path = "./#{ctx.options.binary_name}"

res = Process.run("/usr/bin/env", [binary_path], output: STDOUT, error: STDERR)
@exitcode = res.exit_status
@exitcode = res.exit_code
end
end

0 comments on commit 97b7792

Please sign in to comment.