3

I'm attempting to execute the following bash command on some images using Ruby:

class Pingcrush
  def initialize
    Dir.foreach('drawable') do |item|
      next if item == '.' or item == '..'
      # do work on real items
      if item.end_with?(".png") then
        %x["wine pngcrush.exe -brute drawable/#{item} new/#{item}"]
      end
    end
  end
end
Pingcrush.new

The directory I am in is the parent to both drawable and new, however, when when I attempt to run the script I always get the same error:

sh: wine pngcrush.exe -brute drawable/feed_cl.png new/feed_cl.png: not found

Why is this happening? I tried switching around the path I'm calling in Ruby and can't seem to make this work.

3 Answers 3

5

Its executing your shell but can't find wine. Try setting the full path to where wine is installed.

which wine
Sign up to request clarification or add additional context in comments.

1 Comment

@Aidanc, you should give the full path for wine and your exe file (pngcrush.exe).
1

Don't put quotes around your command.

Comments

1

You have checked that wine pngcrush.exe -brute drawable/feed_cl.png new/feed_cl.png works when you type it from the command line, haven't you?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.