Skip to content

Commit

Permalink
Add expectation for exit code propagation
Browse files Browse the repository at this point in the history
  • Loading branch information
straight-shoota committed Nov 13, 2024
1 parent 4ff8ad5 commit c8d8a61
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion spec/primitives/external_command_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ describe Crystal::Command do
puts Process.find_executable("crystal")
puts PROGRAM_NAME
puts ARGV
exit 123
CRYSTAL

Process.run(compiler_path, ["build", source_file, "-o", command_path])
Expand All @@ -27,7 +29,8 @@ describe Crystal::Command do
lines = process.output.gets_to_end.lines

status = process.wait
status.success?.should be_true
status.normal_exit?.should be_true
status.exit_code.should eq 123

lines.should eq [
compiler_path,
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/crystal/command.cr
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class Crystal::Command
if executable_path = Process.executable_path
crystal_path = File.dirname(executable_path)
end
path = [crystal_path, ENV["PATH"]?].compact_map!.join(Process::PATH_DELIMITER)
path = [crystal_path, ENV["PATH"]?].compact!.join(Process::PATH_DELIMITER)

Process.exec(external_command, options, env: {"PATH" => path})
else
Expand Down

0 comments on commit c8d8a61

Please sign in to comment.