Why will I call the bash command from Ruby?

I am trying to use Ruby to execute the following bash commands on some images:

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 directory of drawable and new, but when I try 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? I tried to switch the path I called in Ruby, and it seems I can’t make it work.

It executes you Shell but can’t find wine. Try to set the full path to install wine.

which wine

I am trying to use Ruby to execute the following bash commands on some images:

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 directory of drawable and new, but when I try 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? I tried to switch the path I called in Ruby, and it seems I can’t make it work.

It executes your shell but can’t find wine. Try to set up and install wine The full path.

which wine

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 3356 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.