diff --git a/lib/omnibus-ctl.rb b/lib/omnibus-ctl.rb index 6f0fa9d..72fa5e9 100644 --- a/lib/omnibus-ctl.rb +++ b/lib/omnibus-ctl.rb @@ -322,7 +322,7 @@ def scary_cleanse_warning(*args) sleep 60 rescue Interrupt log "" - exit 0 + Kernel.exit 1 end end end diff --git a/lib/omnibus-ctl/version.rb b/lib/omnibus-ctl/version.rb index b90cf3a..d2db61e 100644 --- a/lib/omnibus-ctl/version.rb +++ b/lib/omnibus-ctl/version.rb @@ -1,5 +1,5 @@ module Omnibus class Ctl - VERSION = "0.5.0" + VERSION = "0.5.1" end end diff --git a/spec/omnibus-ctl_spec.rb b/spec/omnibus-ctl_spec.rb index e746493..b606e6e 100644 --- a/spec/omnibus-ctl_spec.rb +++ b/spec/omnibus-ctl_spec.rb @@ -668,19 +668,17 @@ def ctl_output describe "cleanse" do before(:each) do - # this is potentially destructive if run on a live system, - # not to mention loaded with sleeps - skip it. + # No-op everything cleanup_procs_and_nuke wants to do, it's destructive + # (and slow/sleep-laden): allow(@ctl).to receive("cleanup_procs_and_nuke").and_return 0 end it "should invoke the cleanse_post_hook" do - # No-op everything cleanup_procs_and_nuke wants to do, it's destructive: expect(@ctl).to receive("command_post_hook") @ctl.run(["cleanse", "yes"]) end it "should invoke the scary_cleanse_warning" do - # No-op everything cleanup_procs_and_nuke wants to do, it's destructive: expect(@ctl).to receive("scary_cleanse_warning") @ctl.run(["cleanse", "yes"]) end @@ -734,6 +732,12 @@ def ctl_output @ctl.scary_cleanse_warning("cleanse") expect(ctl_output).not_to match(/--with-external/) end + + it "will hard-stop when the operator uses Ctrl+C to exit" do + allow(@ctl).to receive(:sleep).and_raise(Interrupt) + expect(Kernel).to receive(:exit).with(1) + @ctl.scary_cleanse_warning("cleanse") + end end context "cleanse_post_hook" do @@ -940,4 +944,7 @@ def ctl_output end end end + + + end