Permalink
Browse files

Merge pull request #861 from tvarley/master

`guard -c` nows clears window buffer on OSX

Fixes #858
  • Loading branch information...
rymai committed Jan 28, 2017
2 parents ab26e4e + 5f4ab94 commit 0c34ac6db1877b3efb8ba41b96160c8110eb21ae
Showing with 5 additions and 3 deletions.
  1. +1 −1 lib/guard/terminal.rb
  2. +4 −2 spec/lib/guard/terminal_spec.rb
View
@@ -4,7 +4,7 @@ module Guard
class Terminal
class << self
def clear
cmd = Gem.win_platform? ? "cls" : "clear;"
cmd = Gem.win_platform? ? "cls" : "printf '\33c\e[3J';"
exit_code, _, stderr = Shellany::Sheller.system(cmd)
fail Errno::ENOENT, stderr unless exit_code == 0
end
@@ -18,7 +18,8 @@
let(:result) { [0, "\e[H\e[2J", ""] }
it "clears the screen using 'clear'" do
expect(sheller).to receive(:system).with("clear;").and_return(result)
expect(sheller).to receive(:system).with("printf '\33c\e[3J';").
and_return(result)
::Guard::Terminal.clear
end
end
@@ -27,7 +28,8 @@
let(:result) { [nil, nil, "Guard failed to run \"clear;\""] }
before do
allow(sheller).to receive(:system).with("clear;").and_return(result)
allow(sheller).to receive(:system).with("printf '\33c\e[3J';").
and_return(result)
end
it "fails" do

0 comments on commit 0c34ac6

Please sign in to comment.