Jump to content
fort

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

Share this post


Link to post

If you click the bug icon in the workflow and set the log to show All information for all objects in this workflow, what do you see there?

Share this post


Link to post

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

Share this post


Link to post

even though they're definitely in my PATH

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.

Share this post


Link to post

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.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...