mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
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
This commit is contained in:
parent
dfe7dca08f
commit
a819d4792b
1 changed files with 6 additions and 6 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue