From c8f34733c7d863f0c4425af464af292336465ce7 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Sep 2026 09:38:12 +0000 Subject: [PATCH] Raise BuildError when a build or install command fails MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `Runner#run!` exited the calling process when its command failed, so a failing `ember build` or dependency installation terminated any Ruby process running it — `EmberCli.compile!` and `EmberCli.install_dependencies!` callers included, and `App#compile` runs during request handling in development, where a build failure could take the Rails server down with it. Raise `EmberCli::BuildError` instead, naming the command and its exit status. The rake tasks (`ember:compile` / `ember:install`) still exit nonzero, now through the uncaught exception, and a request-time build failure surfaces the same way `BuildMonitor#check!` failures already do. This completes the exit removal started for `ember test`, which raises `EmberCli::TestFailureError` since 0.13.1. Co-Authored-By: Claude Fable 5 --- CHANGELOG.md | 7 +++++++ lib/ember_cli/runner.rb | 4 +++- spec/lib/ember_cli/runner_spec.rb | 4 ++-- 3 files changed, 12 insertions(+), 3 deletions(-) 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])