julienXX / terminal-notifier

Send User Notifications on macOS from the command-line.
Other
6.36k stars 331 forks source link

Extra (unrelated?) output on CLI after upgrade to Mojave #262

Closed Gidgidonihah closed 5 years ago

Gidgidonihah commented 5 years ago

I freshly installed High Sierra, installed all my apps and had things running well. I did not notice this issue while in High Sierra, but didn't do much that might have caused it.

I then upgraded to Mojave. Immediately upon opening terminal I began seeing output after every command regardless of terminal (terminal.app or iTerm.app) or shell (bash or zsh).

Googling the output didn't show much that related, but the output did seem to correlate to some other segfault or some unrelated issue. (see bugzilla for example). Here is the output in my case:

2018-10-09 16:53:23.223 terminal-notifier[12744:71678] GetInputSourceEnabledPrefs user file path = /Users/jason/Library/Preferences/com.apple.HIToolbox.plist
2018-10-09 16:53:23.223 terminal-notifier[12744:71678] GetInputSourceEnabledPrefs effective user id path = 501
2018-10-09 16:53:23.223 terminal-notifier[12744:71678] GetInputSourceEnabledPrefs user pref content = <CFBasicHash 0x7fe6e7406570 [0x7fff8cbe18e0]>{type = immutable dict, count = 3,
entries =>
    0 : <CFString 0x7fe6e7405e60 [0x7fff8cbe18e0]>{contents = "AppleInputSourceHistory"} = <CFArray 0x7fe6e740ebc0 [0x7fff8cbe18e0]>{type = immutable, count = 1, values = (
    0 : <CFBasicHash 0x7fe6e7406430 [0x7fff8cbe18e0]>{type = immutable dict, count = 3,
entries =>
    0 : <CFString 0x7fff8cc4ff68 [0x7fff8cbe18e0]>{contents = "InputSourceKind"} = <CFString 0x7fff8cc954a8 [0x7fff8cbe18e0]>{contents = "Keyboard Layout"}
    1 : <CFString 0x7fff8cc4ac68 [0x7fff8cbe18e0]>{contents = "KeyboardLayout Name"} = U.S.
    2 : <CFString 0x7fff8cc815e8 [0x7fff8cbe18e0]>{contents = "KeyboardLayout ID"} = <CFNumber 0xd074c2346daa000d [0x7fff8cbe18e0]>{value = +0, type = kCFNumberSInt64Type}
}

)}
    1 : <CFString 0x7fff8cc716a8 [0x7fff8cbe18e0]>{contents = "AppleSelectedInputSources"} = <CFArray 0x7fe6e7409c90 [0x7fff8cbe18e0]>{type = immutable, count = 1, values = (
    0 : <CFBasicHash 0x7fe6e7402820 [0x7fff8cbe18e0]>{type = immutable dict, count = 3,
entries =>
    0 : <CFString 0x7fff8cc4ff68 [0x7fff8cbe18e0]>{contents = "InputSourceKind"} = <CFString 0x7fff8cc954a8 [0x7fff8cbe18e0]>{contents = "Keyboard Layout"}
    1 : <CFString 0x7fff8cc4ac68 [0x7fff8cbe18e0]>{contents = "KeyboardLayout Name"} = U.S.
    2 : <CFString 0x7fff8cc815e8 [0x7fff8cbe18e0]>{contents = "KeyboardLayout ID"} = <CFNumber 0xd074c2346daa000d [0x7fff8cbe18e0]>{value = +0, type = kCFNumberSInt64Type}
}

)}
    2 : <CFString 0x7fff8ccc3da8 [0x7fff8cbe18e0]>{contents = "AppleCurrentKeyboardLayoutInputSourceID"} = <CFString 0x7fff8cce1808 [0x7fff8cbe18e0]>{contents = "com.apple.keylayout.US"}
}

My bash/zshrc cause terminal-notifier to execute after certain commands, and after tracking it back to this, I found that this output will appear ANY time terminal-notifier is called. For for me:

terminal-notifier -title foo -subtitle bar -message baz

Will show a notification, but also print the above output.

likewise

terminal-notifier --version

results in:

2018-10-09 16:55:29.793 terminal-notifier[12823:73659] GetInputSourceEnabledPrefs user file path = /Users/jason/Library/Preferences/com.apple.HIToolbox.plist
2018-10-09 16:55:29.793 terminal-notifier[12823:73659] GetInputSourceEnabledPrefs effective user id path = 501
2018-10-09 16:55:29.794 terminal-notifier[12823:73659] GetInputSourceEnabledPrefs user pref content = <CFBasicHash 0x7fd1b0e19430 [0x7fff8cbe18e0]>{type = immutable dict, count = 3,
entries =>
    0 : <CFString 0x7fd1b0e19c40 [0x7fff8cbe18e0]>{contents = "AppleInputSourceHistory"} = <CFArray 0x7fd1b0e193f0 [0x7fff8cbe18e0]>{type = immutable, count = 1, values = (
    0 : <CFBasicHash 0x7fd1b0e19710 [0x7fff8cbe18e0]>{type = immutable dict, count = 3,
entries =>
    0 : <CFString 0x7fff8cc4ff68 [0x7fff8cbe18e0]>{contents = "InputSourceKind"} = <CFString 0x7fff8cc954a8 [0x7fff8cbe18e0]>{contents = "Keyboard Layout"}
    1 : <CFString 0x7fff8cc4ac68 [0x7fff8cbe18e0]>{contents = "KeyboardLayout Name"} = U.S.
    2 : <CFString 0x7fff8cc815e8 [0x7fff8cbe18e0]>{contents = "KeyboardLayout ID"} = <CFNumber 0xda70fbb25156ad29 [0x7fff8cbe18e0]>{value = +0, type = kCFNumberSInt64Type}
}

)}
    1 : <CFString 0x7fff8cc716a8 [0x7fff8cbe18e0]>{contents = "AppleSelectedInputSources"} = <CFArray 0x7fd1b0e1a9e0 [0x7fff8cbe18e0]>{type = immutable, count = 1, values = (
    0 : <CFBasicHash 0x7fd1b0e19ca0 [0x7fff8cbe18e0]>{type = immutable dict, count = 3,
entries =>
    0 : <CFString 0x7fff8cc4ff68 [0x7fff8cbe18e0]>{contents = "InputSourceKind"} = <CFString 0x7fff8cc954a8 [0x7fff8cbe18e0]>{contents = "Keyboard Layout"}
    1 : <CFString 0x7fff8cc4ac68 [0x7fff8cbe18e0]>{contents = "KeyboardLayout Name"} = U.S.
    2 : <CFString 0x7fff8cc815e8 [0x7fff8cbe18e0]>{contents = "KeyboardLayout ID"} = <CFNumber 0xda70fbb25156ad29 [0x7fff8cbe18e0]>{value = +0, type = kCFNumberSInt64Type}
}

)}
    2 : <CFString 0x7fff8ccc3da8 [0x7fff8cbe18e0]>{contents = "AppleCurrentKeyboardLayoutInputSourceID"} = <CFString 0x7fff8cce1808 [0x7fff8cbe18e0]>{contents = "com.apple.keylayout.US"}
}
terminal-notifier (2.0.0) is a command-line tool to send macOS User Notifications.

Usage: terminal-notifier -[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.
       -version           Display terminal-notifier version.
       -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.

   Optional:

       -title VALUE       The notification title. Defaults to ‘Terminal’.
       -subtitle VALUE    The notification subtitle.
       -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.
       -activate ID       The bundle identifier of the application to activate when the user clicks the notification.
       -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)
       -open URL          The URL of a resource to open when the user clicks the notification.
       -execute COMMAND   A shell command to perform when the user clicks the notification.
       -ignoreDnD         Send notification even if Do Not Disturb is enabled.

When the user activates a notification, the results are logged to the system logs.
Use Console.app to view these logs.

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/julienXX/terminal-notifier.

Please check everything that applies to your issue:

To help us debug your issue please include:

Gidgidonihah commented 5 years ago

Hmm, this very well could be something of which terminal-notifier is showing a symptom, rather than the cause.

I've found that I can, for example, cause the same output by running:

osascript -e 'display notification "Lorem ipsum dolor sit amet" with title "Title"'

Regardless without knowing what triggers it, be that some permission issue or something else, terminal-notifier is rendered unusable for me.

Gidgidonihah commented 5 years ago

Hmm. I should have tried this earlier, it does appear to have been a symptom of a bad plist on my system. A quick removal of the plist mentioned in the log (/Users/jason/Library/Preferences/com.apple.HIToolbox.plist) and all was well. I verified that after correctly regenerating the plist, things still worked correctly.