From a819d4792bbc63d993d6dd2b15f9af5efb0c2d8c Mon Sep 17 00:00:00 2001 From: "Brian J. Cardiff" Date: Sat, 15 Aug 2020 12:09:53 -0300 Subject: [PATCH] Refactor run_spec to use process exit instead of empty stderr (#584) Bonus: It also allows run_spec to pass if using bin/crystal wrapper --- spec/run_spec.cr | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/run_spec.cr b/spec/run_spec.cr index 818cbe9..ec89d23 100644 --- a/spec/run_spec.cr +++ b/spec/run_spec.cr @@ -5,12 +5,12 @@ private def run(code) require "./src/kemal" #{code} CR - String.build do |stdout| - stderr = String.build do |io| - Process.new("crystal", ["eval"], input: IO::Memory.new(code), output: stdout, error: io).wait - end - fail(stderr) unless stderr.empty? - end + + stdout = IO::Memory.new + stderr = IO::Memory.new + status = Process.new("crystal", ["eval"], input: IO::Memory.new(code), output: stdout, error: stderr).wait + fail(stderr.to_s) unless status.success? + stdout.to_s end describe "Run" do