Hi - I am new to this forum, although I have some experience creating several PopClip Extensions for my personal special purposes. And I know that I am very late to this thread . I have the following PopClip extension for the GoToFile app calling a built in executable to execute a search on the currently selected project (i. e. folder mix). It’s exceedingly simple and works in principle:
But on every execution I see the above mentioned spinner for annoying 3 or more seconds. Why is this? No Apple Script involved, PopClip does not need to wait for any response by anything but simply send a command to zsh.
What am I possible doing wrong here?
I change my initial approach of simply giving zsh as interpreter and gtfs as executable by using the respective full paths (I created a symbolic link in /usr/local/bin to the executable residing in GTF’s application bundle for ease of use). No change. Same if I use the direct path into the package (/Applications/GoToFile.app/Contents/Resources/bin/gtfs).
because I suspected the issue might be related to the loading time of the shell.
While /bin/sh starts up instantaneously, the issue remains unresolved.
PopClip will patiently wait for the zsh process to complete even if it’s not returning any data.
Is gtfs running for those 3 seconds? Since we don’t need to wait for a response, try running the gtfs command in the background by adding a & at the end of your shell script command:
But I am always getting the cryptic (bogus) error:
An error occurred: You’re replying a bit too quickly. Please wait 4 minutes before trying again.
Too quickly, for what. 4 minutes have passed long ago and several times on top of it. It always comes up with this error…
I am afraid I find this very annoying - now got this error again for trying to post in this thread. This time it complains about being 53 seconds to early…
So the post is somehow on topic, now.
PopClip runs scripts within a non-interactive login shell instance of your default shell.
So even if you specify sh as the interpreter the PopClip extension config, it will still call an instance of zsh (assuming zsh is your system default shell) first. PopClip will run this command:
/bin/zsh -lc '/bin/sh'
…and pipe the script contents into that.
Any zsh startup scripts that would be run by a default zsh login shell will therefore be run on each invocation by PopClip.
(The reason it’s ‘wrapped’ in a default shell call like this is to ensure it has access to your path and other login shell variables that your scripts might need.)
Do consider whether you actually need need your startup scripts for all login shells, or only for interactive shells — in which case you could move them to .zshrc.
This works perfectly (but of course might have its drawbacks otherwise): GTF responds within a split of a second.
Any chance to make this settable by extension?
E. g. by setting the interpreter to zsh-c or something?
This would be the easiest fix for lazy me
Not yet tried the other options, but I remember vividly the horrible amount of experimentation with various zsh configuration files to finally come up with a config that works for me and which I am therefore reluctant to change…
Ah, good. I think most of the stuff that people have in startup scripts, like oh-my-zsh and such things, tend only to be needed for interactive shells, so you should be OK. Let me know if you run into any trouble. I’m certainly open to tweaking things if there is a demonstrable need.