Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Execute not working #265

Open
Marsgames opened this issue Dec 17, 2018 · 6 comments
Open

Execute not working #265

Marsgames opened this issue Dec 17, 2018 · 6 comments

Comments

@Marsgames
Copy link

Hey,

I'm trying to execute a simple diff check when I click on my notification but it's not working. I tried to add -activate com.apple.Terminal and this one works but after that nothing more. I tried to run an osascript that will open a new terminal window and then run my command but it doesn't work much.

My command

terminal-notifier -title "My notification" -message "The description" -activate com.apple.Terminal -execute "diff .bashrc .gitconfig"

macOS : 10.14.2
terminal-notifier : 2.0.0
Install with brew install terminal-notifier

Thanks

@julienXX
Copy link
Owner

Have you tried using the full path for the diff tool and the files you want to compare?

@Marsgames
Copy link
Author

Yep sir, same result

@NateEag
Copy link

NateEag commented May 22, 2019

I'm not sure this is likely to happen with diff, but I hit an issue that looked like -execute failing because the command I was running would fail if run without first sourcing ~/.bashrc.

Since -execute is not an interactive shell, my ~/.bashrc was never loaded, and thus some of the configuration my command required was not available, causing silent failure.

I didn't think to check this until after I figured it out, but I opened up Console.app and checked in system.log, and there was indeed a record of the failure there. Nothing very useful, just that the process exited with status 1:

... (fr.julienxx.oss.terminal-notifier.3924[15942]): Service exited with abnormal code: 1

I then tried running my known-bad command while Console.app was open, and then the error output from the failed command was visible when I had my laptop selected in the "Devices" section of the sidebar.

@julienXX , I suggest updating the docs to point out that if you want to see output from terminal-notifier, opening Console.app, selecting your device, and running it will do the job. Add a parenthetical note that this is especially useful for debugging silent failures from -execute commands and I think this would bite fewer people.

@amandamana
Copy link

I've found that -execute fails when combined with -sender at least on Mojave. The same shell commands trigger if I don't fake the sender. Probably worth noting that this wasn't a problem on El Capitan.

@kupietools
Copy link

-execute is silently failing for me even with console open.

Command: /Applications/terminal-notifier.app/Contents/MacOS/terminal-notifier -message INBOX -execute "/Applications/Betterbird.app/Contents/MacOS/betterbird-bin"

Console output shen I click the show button:

default	11:07:47.878237-0400	usernoted	Received response <NotificationRecord app:"fr.julienxx.oss.terminal-notifier" ident:"DA39-A3EE" uuid:"B19D7215" source:"1B1B8FC6" <response action: action actIdent: ACTION foreground: false text: nil> >
debug	11:07:47.878333-0400	usernoted	Removing delivered <NotificationRecord app:"fr.julienxx.oss.terminal-notifier" ident:"DA39-A3EE" uuid:"B19D7215" source:"1B1B8FC6" <response action: closed actIdent:  foreground: true text: nil> >
debug	11:07:47.878720-0400	usernoted	Removing displayed <NotificationRecord app:"fr.julienxx.oss.terminal-notifier" ident:"DA39-A3EE" uuid:"B19D7215" source:"1B1B8FC6" <response action: closed actIdent:  foreground: true text: nil> >
info	11:07:47.879136-0400	usernoted	Response <NotificationRecord app:"fr.julienxx.oss.terminal-notifier" ident:"DA39-A3EE" uuid:"B19D7215" source:"1B1B8FC6" <response action: action actIdent: ACTION foreground: false text: nil> > sent to NSUserNotification client <ClientConnect: 0x00007fe4ebe19980 identifier: fr.julienxx.oss.terminal-notifier pid: 66552 type: Application source=<SourceIdentifier: { uuid: 1B1B8FC6-D260-41DB-9CE0-727ED0020B41 signed: false appleSigned: false daemon: false isPush: false flags: 1 path: /Applications/terminal-notifier.app } >>
debug	11:07:47.879264-0400	usernoted	msg of 2 sent for fr.julienxx.oss.terminal-notifier
info	11:07:47.883439-0400	NotificationCenter	Queuing action removeAlert for app fr.julienxx.oss.terminal-notifier items 0
info	11:07:47.883522-0400	NotificationCenter	Queuing action removeAlert for app fr.julienxx.oss.terminal-notifier items 0
default	11:07:47.883861-0400	NotificationCenter	Unable to find notification to delete matching B19D7215-7BCA-43E6-9B1E-DE2C91914242 fr.julienxx.oss.terminal-notifier
info	11:07:47.898293-0400	NotificationCenter	Queuing action removeDelivered for app fr.julienxx.oss.terminal-notifier items 0
default	11:07:47.898452-0400	NotificationCenter	Unable to find notification to delete matching B19D7215-7BCA-43E6-9B1E-DE2C91914242 fr.julienxx.oss.terminal-notifier

When I enter /Applications/Betterbird.app/Contents/MacOS/betterbird-bin on the command line, Betterbird opens as expected.

I checked my privacy & security preferences, terminal-notifier.app has full privileges for accessibility, automation, and disk access.

@kupietools
Copy link

kupietools commented May 21, 2024

Not long after my last comment, it started working again with my having done anything. Now it stopped again, once again without my having done anything.

EDIT: As noted in the issue about open not working #306, belay that. I somehow had a frozen terminal-notifier process in the background. I killed it and open and execute suddenly work again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants