alexreg Posted March 22, 2019 Share Posted March 22, 2019 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. Link to comment
deanishe Posted March 22, 2019 Share Posted March 22, 2019 You could set a variable based on the exit code and use that in a test. Link to comment
alexreg Posted March 22, 2019 Author Share Posted March 22, 2019 How would I go about that exactly? Link to comment
deanishe Posted March 22, 2019 Share Posted March 22, 2019 (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: ./my_script.sh if [[ $? != 0 ]]; then echo -n "FAILED" fi then a Filter: Edited March 22, 2019 by deanishe Link to comment
alexreg Posted March 23, 2019 Author Share Posted March 23, 2019 Ah, that makes sense. Thanks! I wish Alfred would add a feature “only continue if exit code is (not) X." luckman212 1 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now