Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix which command on ubuntu #7

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/image_optim.rb
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,9 @@ def resolve_bin!(bin)
symlink.make_symlink(File.expand_path(path))
at_exit{ symlink.unlink }

@resolved_bins[bin] = system(*%W[which -s #{symlink}])
@resolved_bins[bin] = system(*%W[which #{symlink} > /dev/null])
else
@resolved_bins[bin] = system(*%W[which -s #{bin}])
@resolved_bins[bin] = system(*%W[which #{bin} > /dev/null])
end
end
end
Expand Down
8 changes: 4 additions & 4 deletions spec/image_optim_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def with_env(key, value)
it "should resolve bin in path" do
with_env 'LS_BIN', nil do
image_optim = ImageOptim.new
image_optim.should_receive(:system).with(*%w[which -s ls]).once.and_return(true)
image_optim.should_receive(:system).with(*%w[which ls > /dev/null]).once.and_return(true)
FSPath.should_not_receive(:temp_dir)

5.times do
Expand All @@ -212,7 +212,7 @@ def with_env(key, value)
symlink = stub(:symlink)

image_optim = ImageOptim.new
image_optim.should_receive(:system).with(*%W[which -s #{symlink}]).once.and_return(true)
image_optim.should_receive(:system).with(*%W[which #{symlink} > /dev/null]).once.and_return(true)
FSPath.should_receive(:temp_dir).once.and_return(tmpdir)
tmpdir.should_receive(:/).with(:image_optim).once.and_return(symlink)
symlink.should_receive(:make_symlink).with(File.expand_path(path)).once
Expand All @@ -235,7 +235,7 @@ def with_env(key, value)
it "should raise on failure to resolve bin" do
with_env 'SHOULD_NOT_EXIST_BIN', nil do
image_optim = ImageOptim.new
image_optim.should_receive(:system).with(*%w[which -s should_not_exist]).once.and_return(false)
image_optim.should_receive(:system).with(*%w[which should_not_exist > /dev/null]).once.and_return(false)
FSPath.should_not_receive(:temp_dir)

5.times do
Expand All @@ -253,7 +253,7 @@ def with_env(key, value)
symlink = stub(:symlink)

image_optim = ImageOptim.new
image_optim.should_receive(:system).with(*%W[which -s #{symlink}]).once.and_return(false)
image_optim.should_receive(:system).with(*%W[which #{symlink} > /dev/null]).once.and_return(false)
FSPath.should_receive(:temp_dir).once.and_return(tmpdir)
tmpdir.should_receive(:/).with(:should_not_exist).once.and_return(symlink)
symlink.should_receive(:make_symlink).with(File.expand_path(path)).once
Expand Down