title case is also prepending the text with the output of `uptime`

I installed popclip, added the Title case extension, highlight some text in a cell in Numbers, clicked on the icon for title case, and it worked. however it also put the output of the uptime command in front of my text, which currently looks like this:

21:53 up 16 days, 5:44, 12 users, load averages: 2.66 2.63 3.22

I tried quitting numbers and popclip, but when I ran them again, it still did it.

21:55 up 16 days, 5:45, 12 users, load averages: 2.57 2.61 3.16
Let’s See if It Does It Here

21:55 up 16 days, 5:45, 12 users, load averages: 1.83 2.43 3.08
Why Yes, It Does.

has anyone seen this before??

That’s very odd! Scratching my head on this one.

The extension uses a perl script. Is your system somehow configured to run uptime when calling perl scripts?

I found the cause, but I’m not happy about it. When the extension runs, instead of using a non-interactive shell to run the Perl script, it’s using a full interactive login shell; I can tell because my ~/.zlogin is being run which, among other things, runs the uptime command. So I’d call this a bug in the extension; it shouldn’t be running an interactive login shell.

1 Like

Thanks for the update.

We need to get to the bottom of this together. PopClip runs the titlecase.pl script in your login shell environment but it should not be doing so interactively.

PopClip calls extension scripts as follows:

  1. First it looks for the value of the SHELL variable in PopClip’s environment variables (e.g. /bin/zsh)
  2. Then it calls that interpreter with the arguments -lc followed by the script path: E.g.

/bin/zsh -lc /path/to/titlecase.pl

Note that -l indicates a login shell and -c indicates a non-interactive shell.

So PopClip does not use an interactive login shell, only a login shell.

What shell do you use and does it support the -c argument to specify non-interactive?
Edit: see below instead

I’m thinking you might be wanting PopClip to use a non-login shell rather than a non-interactive shell, since .zlogin is run at the launch of a zsh login shell. (Commands to be run at the start of an interactive shell go in .zshrc.)

If that is the case, there is an option for this. You can set a hidden pref as follows, in Terminal:

defaults write com.pilotmoon.popclip NoLoginShell -bool YES

then quit and restart PopClip.

Now it will call it with only the -c option, for all extensions. It shouldn’t break any of the official extensions.

(The reason it uses a login shell by default is that many of the custom extensions people write for themselves are calling tools in the user’s PATH and generally expect a login shell environment.)

Alternatively, you could put your startup commands intended for interactive shell only in .zshrc instead of .zlogin, then they will never get run by PopClip.

1 Like

ok, yes, I’m moving “uptime” from .zlogin to .zshrc. I’m wondering why I’ve never had trouble with this before. I do remote commands over ssh and various other non-interactive things

1 Like