Stacks Posted June 28, 2023 Share Posted June 28, 2023 Hi Team! I have a workflow I've made that passes alfred arguments to a CLI application and executes it using the "External Script" option for ZSH, as argv, like so: command -q ${query} This no longer works on the latest pre-release (5.1.2) and quit working (no changes), so I have reached out to support. I found that it does work if I replace with the full path, i.e. /users/user.name/.bin/command -q ${query} However, that path will be different depending on the user, so it's not ideal. However, using "~/.bin/command -q" does not work and returns a "Command not found" What is the best way of handling this? All of the above work successfully from the CLI directly. Link to comment
vitor Posted June 28, 2023 Share Posted June 28, 2023 31 minutes ago, Stacks said: I found that it does work if I replace with the full path, i.e. /users/user.name/.bin/command -q ${query} Indeed. This is the correct approach. 31 minutes ago, Stacks said: However, that path will be different depending on the user Instead of /Users/username, do ${HOME} which works the same but will be relative to the user. Alternatively, do source ~/.zshenv beforehand as that’s bound to be the difference (see Alfred release notes). To understand more, see Understanding the Scripting Environment. Stacks 1 Link to comment
Stacks Posted June 28, 2023 Author Share Posted June 28, 2023 Thank you for sharing that link - I searched all across the Alfred docs and hadn't see it. Also thanks for mentioning $HOME - I didn't see that in the list of Alfred vars when I exported an initial list, so wasn't sure if one existed. Adding an "export PATH=" to the top of the script resolved the issue, and appears to handle the ~ correctly. Link to comment
Stacks Posted June 28, 2023 Author Share Posted June 28, 2023 Can you point me towards what specific release notes you are mentioning? I didn't see anything specific that mentions a need to import/source. Link to comment
Andrew Posted June 29, 2023 Share Posted June 29, 2023 @Stacks in the current 5.1.2 pre-release, I added the --no-rcs flag when selecting the /bin/zsh script language in a Script Filter or Run Script. This change is to prevent something in a .zshenv file from breaking the expected output in a script. 10 hours ago, Stacks said: Can you point me towards what specific release notes you are mentioning? This is mentioned here: https://www.alfredapp.com/changelog/ but not yet expanded upon as we are still in the pre-release. If this change sticks through to the 5.1.2 general release, we will create a KB article to detail this change. Having said that, this change should not affect your workflow if you're using External Script as the script language. Would it be possible to share the workflow so we could take a look at why you're seeing a difference? Are you using a .zshenv file, if so, could we see the contents? Cheers, Andrew Link to comment
Stacks Posted June 29, 2023 Author Share Posted June 29, 2023 (edited) Thanks for clarifying - I am using "Run Script" with /bin/zsh & input as argv, and the zshenv file includes the import path of the rust executables ("$HOME/.cargo/env") so that would explain why it doesn't work after migrating (and why adding "export PATH=$PATH:~/.cargo/bin/" allows it to work again) I'll see if I can migrate to an external script and test. Edited June 29, 2023 by Stacks Link to comment
xilopaint Posted July 20, 2023 Share Posted July 20, 2023 On 6/29/2023 at 7:11 AM, Andrew said: @Stacks in the current 5.1.2 pre-release, I added the --no-rcs flag when selecting the /bin/zsh script language in a Script Filter or Run Script. This change is to prevent something in a .zshenv file from breaking the expected output in a script. This is mentioned here: https://www.alfredapp.com/changelog/ but not yet expanded upon as we are still in the pre-release. If this change sticks through to the 5.1.2 general release, we will create a KB article to detail this change. Having said that, this change should not affect your workflow if you're using External Script as the script language. Would it be possible to share the workflow so we could take a look at why you're seeing a difference? Are you using a .zshenv file, if so, could we see the contents? Cheers, Andrew This is a cool feature. I'll be updating my workflows with this as soon as 5.1.2 gets stable. vitor 1 Link to comment
xilopaint Posted July 23, 2023 Share Posted July 23, 2023 @Andrew @vitor Should we expect the workflows to run faster with the new --no-rcs flag since these files won’t be sourced? Also, are we close to the release of the stable 5.1.2? I want to update a couple of workflows and should decide if I'll wait for 5.1.2. Link to comment
vitor Posted July 24, 2023 Share Posted July 24, 2023 Speed depends on if the user has a ~/.zshenv or not and what it does. But it should never be slower. /bin/zsh --no-rcs gracefully switches to /bin/zsh on older Alfred versions. Link to comment
xilopaint Posted July 24, 2023 Share Posted July 24, 2023 19 hours ago, vitor said: Speed depends on if the user has a ~/.zshenv or not and what it does. But it should never be slower. Is it only for ~/.zshenv or ~/.zshrc as well? Link to comment
vitor Posted July 25, 2023 Share Posted July 25, 2023 ~/.zshrc Was already ignored in normal operation. Only ~/.zshenv is different. 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