Skip to content

Commit 06391d4

Browse files
build: Fix to raise error when command failed with Open3
1 parent 5a28621 commit 06391d4

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

lib/ruby_wasm/build.rb

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,16 @@ def system(*args, chdir: nil, env: nil)
5959
[out, err, wait_thr.value]
6060
end
6161
begin
62-
if env
63-
Open3.popen3(env, *args, **kwargs, &block)
64-
else
65-
Open3.popen3(*args, **kwargs, &block)
62+
stdout, stderr, status =
63+
if env
64+
Open3.popen3(env, *args, **kwargs, &block)
65+
else
66+
Open3.popen3(*args, **kwargs, &block)
67+
end
68+
unless status.success?
69+
$stderr.puts stdout
70+
$stderr.puts stderr
71+
raise "Command failed with status (#{status.exitstatus}): #{args.join(" ")}"
6672
end
6773
ensure
6874
printer.done

0 commit comments

Comments
 (0)