diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e756ac2..e6f788a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +main +------ + +* Raise `EmberCli::BuildError` when `ember build` or a dependency + installation fails, instead of exiting the process from inside the gem — + `rake ember:compile` and `rake ember:install` still exit nonzero + 0.13.1 ------ diff --git a/lib/ember_cli/runner.rb b/lib/ember_cli/runner.rb index 3f7242d3..64d52156 100644 --- a/lib/ember_cli/runner.rb +++ b/lib/ember_cli/runner.rb @@ -1,5 +1,7 @@ require "open3" +require "ember_cli/errors" + module EmberCli class Runner def initialize(out:, err:, env: {}, options: {}) @@ -25,7 +27,7 @@ def run(command) def run!(command) run(command).tap do |status| unless status.success? - exit status.exitstatus + fail BuildError, "`#{command}` failed with status #{status.exitstatus}" end end end diff --git a/spec/lib/ember_cli/runner_spec.rb b/spec/lib/ember_cli/runner_spec.rb index e0c15bc3..ec93e854 100644 --- a/spec/lib/ember_cli/runner_spec.rb +++ b/spec/lib/ember_cli/runner_spec.rb @@ -12,7 +12,7 @@ ) expect { runner.run!(command_with_error(out: "out")) }. - to raise_error(SystemExit) + to raise_error(EmberCli::BuildError, /failed with status 1/) expect(split_output_from_stream(stdout)).to eq(%w[out out]) expect(split_output_from_stream(logfile)).to eq(%w[out out]) @@ -27,7 +27,7 @@ ) expect { runner.run!(command_with_error(err: "err")) }. - to raise_error(SystemExit) + to raise_error(EmberCli::BuildError, /failed with status 1/) expect(split_output_from_stream(stderr)).to eq(%w[err err]) expect(split_output_from_stream(logfile)).to eq(%w[err err])