Shell script statement works in Terminal, fails in Hazel (2)

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Again, I have a one-line bash script that works both on the command line and in Code Runner, but fails in Hazel.

It is simply a call to the utility convmv (installed through homebrew) that converts a filename from one charset to another and looks like this.

Code: Select all
convmv -i --notest -f utf8 -t iso-8859-1 "$1"


When putting this into a "Run shell script/embedded script" command and running the rule, in Activity MonItor I can see a "per5.16" process using 99.9 % CPU and the rule does not complete.

Adding and exporting variables for LANG and LC_CTYPE as per my related post (https://www.noodlesoft.com/forums/viewtopic.php?f=4&t=6682&p=19042&hilit=shell+script+fails#p19042) does not change anything.

What is necessary to make this work in Hazel?

Thanks!
WorkflowsGuy
 
Posts: 30
Joined: Thu Jul 04, 2013 3:55 pm

Use a full path to convmv. You can't assume the path is what you use in your interactive shell.

If you are still having problems, have the script print output. You can turn on debug mode in Hazel to view that output in the logs: https://www.noodlesoft.com/kb/hazel-debug-mode/
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Hello Mr. Noodle,

Use a full path to convmv. You can't assume the path is what you use in your interactive shell.

All the commands installed through Homebrew work in my shell scripts called from Hazel rules without needing a full path. But just to be sure, I added the full path in my script -> no improvement.

As I became aware only through this issue, convmv is a Perl script. So the command is found as the "stuck" Perl5.16 interpreter process shows.

I also added an echo "Test" as the first line in my shell script as you suggested, but the "Test" is not output in the Hazel debug log when the rule is executed. The shell script looks like this:

Code: Select all
echo "Test"
LC_CTYPE=UTF-8
export LC_CTYPE
convmv -i --notest -f utf8 -t iso-8859-1 "$1"

So the question is, what is different in the calling/execution process of Hazel->Bash shell script->Perl script that causes the Perl interpreter to get locked?
WorkflowsGuy
 
Posts: 30
Joined: Thu Jul 04, 2013 3:55 pm

The output won't appear until the script finishes. As for why it's locked, I can't say. Try a simpler perl script to help isolate the issue.
Mr_Noodle
Site Admin
 
Posts: 11872
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Turns out, it is not a good idea to call a command from Hazel with it's "interactive" option enabled... :roll:
WorkflowsGuy
 
Posts: 30
Joined: Thu Jul 04, 2013 3:55 pm


Return to Support