diff --git a/spec/primitives/external_command_spec.cr b/spec/primitives/external_command_spec.cr index 5e9b40a65dfb..3d0e755f9e4e 100644 --- a/spec/primitives/external_command_spec.cr +++ b/spec/primitives/external_command_spec.cr @@ -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]) @@ -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, diff --git a/src/compiler/crystal/command.cr b/src/compiler/crystal/command.cr index c23259f90e09..e5b430264066 100644 --- a/src/compiler/crystal/command.cr +++ b/src/compiler/crystal/command.cr @@ -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