Jump to content

Stop running workflow if exit code is non-zero

Recommended Posts

How can I stop Alfred from proceeding to the next block/action in a workflow if the exit code of the previous one (a "run script" action) is non-zero?


Thanks in advance.

Share this post

Link to post
Posted (edited)

Well, in bash the exit code of the last run command is $?. Setting variables is a bit tricky because you need to echo JSON to do that, but you could use echo and a Filter Utility to stop the workflow:

if [[ $? != 0 ]]; then
    echo -n "FAILED"

then a Filter:



Edited by deanishe

Share this post

Link to post

Ah, that makes sense. Thanks! I wish Alfred would add a feature “only continue if exit code is (not) X."

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.

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