vjeantet / alerter

Send User Alert Notification on Mac OS X from the command-line.
MIT License
936 stars 62 forks source link

No notifications, hanging command on Catalina #26

Open normen opened 4 years ago

normen commented 4 years ago

When I run the alerter command (release 003) on MacOS 10.15 it doesn't throw any errors but the notification never appears and the execution of the alerter command never returns.

I previously ran it (release 002) on MacOS 10.14 without issues.

normen commented 4 years ago

Funnily, when I install the binary using the brew install from #25 it works... When running the downloaded binary directly it doesn't.

hagai-lvi commented 4 years ago

Same for me

Haravikk commented 4 years ago

I'm getting a slightly different problem; whenever I try to run the pre-built binary I just get a single line of output "Killed: 9", with no commands working.

The pre-built Catalina binary definitely doesn't seem to be working for some reason.

telotortium commented 4 years ago

An issue which might be related: the Info.plist file doesn't seem to be properly read, since the app can't find its application name (see the (null) in the help text):

$ alerter
(null) ((null)) is a command-line tool to send OS X User Notifications.

Usage: (null) -[message|list|remove] [VALUE|ID|ID] [options]

   Either of these is required (unless message data is piped to the tool):

       -help              Display this help banner.
       -message VALUE     The notification message.
       -remove ID         Removes a notification with the specified ‘group’ ID.
       -list ID           If the specified ‘group’ ID exists show when it was delivered,
                          or use ‘ALL’ as ID to see all notifications.
                          The output is a tab-separated list.

   Reply type notification:

       -reply VALUE       The notification will be displayed as a reply type alert, VALUE used as placeholder.

   Actions type notification:

       -actions VALUE1,VALUE2.
                          The notification actions avalaible.
                          When you provide more than one value, a dropdown will be displayed.
                          You can customize this dropdown label with the next option.
       -dropdownLabel VALUE    The notification actions dropdown title (only when multiples actions are provided.

   Optional:

       -title VALUE       The notification title. Defaults to ‘Terminal’.
       -subtitle VALUE    The notification subtitle.
       -closeLabel VALUE  The notification close button label.
       -sound NAME        The name of a sound to play when the notification appears. The names are listed
                          in Sound Preferences. Use 'default' for the default notification sound.
       -group ID          A string which identifies the group the notifications belong to.
                          Old notifications with the same ID will be removed.
       -sender ID         The bundle identifier of the application that should be shown as the sender, including its icon.
       -appIcon URL       The URL of a image to display instead of the application icon (Mavericks+ only)
       -contentImage URL  The URL of a image to display attached to the notification (Mavericks+ only)
       -json       Write only event or value to stdout
       -timeout NUMBER    Close the notification after NUMBER seconds.

When the user activates or close a notification, the results are logged to stdout as a json struct.

Note that in some circumstances the first character of a message has to be escaped in order to be recognized.
An example of this is when using an open bracket, which has to be escaped like so: ‘\[’.

For more information see https://github.com/vjeantet/alerter.
telotortium commented 4 years ago

The backtrace when alerter is hanging looks like this - perhaps we're in an infinite loop:

* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  * frame #0: 0x00007fff6d52cdfa libsystem_kernel.dylib`mach_msg_trap + 10
    frame #1: 0x00007fff6d52d1fd libsystem_kernel.dylib`mach_msg + 201
    frame #2: 0x00007fff333f0f85 CoreFoundation`__CFRunLoopServiceMachPort + 247
    frame #3: 0x00007fff333efa52 CoreFoundation`__CFRunLoopRun + 1319
    frame #4: 0x00007fff333eeece CoreFoundation`CFRunLoopRunSpecific + 462
    frame #5: 0x00007fff3201dabd HIToolbox`RunCurrentEventLoopInMode + 292
    frame #6: 0x00007fff3201d7d5 HIToolbox`ReceiveNextEventCommon + 584
    frame #7: 0x00007fff3201d579 HIToolbox`_BlockUntilNextEventMatchingListInModeWithFilter + 64
    frame #8: 0x00007fff30665829 AppKit`_DPSNextEvent + 883
    frame #9: 0x00007fff30664070 AppKit`-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1352
    frame #10: 0x00007fff30655d7e AppKit`-[NSApplication run] + 658
    frame #11: 0x0000000100005d0e alerter`main(argc=3, argv=0x00007ffeefbfe8c0) at main.m:28:5
    frame #12: 0x00007fff6d3ebcc9 libdyld.dylib`start + 1
Haravikk commented 4 years ago

I tried building from source and alerter works just fine that way, it seems to just be the pre-built binary that doesn't work properly for some reason; I can trigger alerts without issue, except that I had to approve them first in Notification Center.

Just download (clone -> zip) from Github, open the Xcode project in a recent version of Xcode, hit build and find the binary it produces; worked just fine for me.

There is still something weird with the usage output though, the few first lines look like this for me:

alerter --help
 ${EXECUTABLE_NAME} ($(MARKETING_VERSION)) is a command-line tool to send OS X User Notifications.   

 Usage: ${EXECUTABLE_NAME} -[message|list|remove] [VALUE|ID|ID] [options]

   Either of these is required (unless message data is piped to the tool)
rdp commented 3 years ago

Same for me on Big Sur, using homebrew version (i.e. built locally) and it worked...