Jump to content

one line shell script does nothing in a workflow


Recommended Posts

Hi all,

 

I'm sure there's an easy answer to this, but could someone explain to me why a simple Keyword to Script workflow, consisting of a keyword foo and the following one-line bash script (where mate is the TextMate shell utility and bar is the absolute path to a text file)

sudo mate bar

does absolutely nothing, even though it works fine when I run it in Terminal,.

 

This workflow used to work, but it hasn't for the past couple of months (I think, because I don't use it very often). It's not a huge deal, but I'd like to understand what's broken it. It's not because it's run with sudo, because mate bar does nothing (where bar is in my home directory in this case), and neither is it a problem with mate, because vi bar doesn't work either. All my other Keyword to Script workflows are working fine, including a test one I just created with rm bar as the script.

 

Any ideas as to why I can't invoke text editors in workflows? Thanks!

 

fort

Link to comment

I get

Starting debug for 'Edit hosts'

[ERROR: alfred.workflow.action.script] Code 1: sudo: mate: command not found

which suggests that the workflow needs the full path to any text editor (even though they're definitely in my PATH). I just tried it with the absolute path, and it now works.

 

I'm wondering wtf has changed though, because this same workflow was working a couple of months ago.

 

Many thanks for the tip, in any case. It immediately led me to the solution, and it'll be useful for future debugging!

 

fort

Link to comment

But Alfred does not read your PATH, which is why it didn’t work. Alternatively to using the full path, you can define PATH at the top of the Run Script node.

 

Yes, I remember coming up against this problem before and I don't know why it didn't occur to me sooner. I think I was thrown by the fact that this workflow used to work (which doesn't make sense, in hindsight), and I didn't make any changes to it.

 

Thanks.

Link to comment

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...