Jump to content

When putting a workflow in debug mode, display stdout too

Recommended Posts

I made a keyboard shortcut to trigger a script, but it wasn't working.


I stumbled across debug mode, and as soon as I tried the shortcut, I saw this:



[2016-08-28 21:48:58][ERROR: action.script] /Users/adcurtin/bin/NoSleepToggle: line 4: NoSleepCtrl: command not found

/Users/adcurtin/bin/NoSleepToggle: line 11: NoSleepCtrl: command not found


Great, super easy solution: use the full path in the script.


However, I was curious what the path was, so I dropped an 'echo $PATH' in the script, but debug mode doesn't show stdout for some reason, only stderr. This is the first time I've ever had to use 1>&2 in a bash script (which showed me the PATH used is /usr/bin:/bin:/usr/sbin:/sbin)


My suggestion is simply to also display stdout in debug mode (or an option to).

Link to comment
Share on other sites

You should use echo $PATH > /dev/stderr instead.
STDOUT is only for the data Alfred should pass to the next action. If you write anything else to STDOUT, your workflow won't work as expected. If it's a Script Filter, you will break it completely by invalidating the XML/JSON output.
In the debugger, set Log to "All information" instead of "Interesting information". That will also show element input/output (i.e. STDOUT).

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...