Skip to content

Commit c8d8a61

Browse files
Add expectation for exit code propagation
1 parent 4ff8ad5 commit c8d8a61

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

spec/primitives/external_command_spec.cr

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ describe Crystal::Command do
1212
puts Process.find_executable("crystal")
1313
puts PROGRAM_NAME
1414
puts ARGV
15+
16+
exit 123
1517
CRYSTAL
1618

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

2931
status = process.wait
30-
status.success?.should be_true
32+
status.normal_exit?.should be_true
33+
status.exit_code.should eq 123
3134

3235
lines.should eq [
3336
compiler_path,

src/compiler/crystal/command.cr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ class Crystal::Command
135135
if executable_path = Process.executable_path
136136
crystal_path = File.dirname(executable_path)
137137
end
138-
path = [crystal_path, ENV["PATH"]?].compact_map!.join(Process::PATH_DELIMITER)
138+
path = [crystal_path, ENV["PATH"]?].compact!.join(Process::PATH_DELIMITER)
139139

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

0 commit comments

Comments
 (0)