node-notifier icon indicating copy to clipboard operation
node-notifier copied to clipboard

Invalid input crashes terminal-notifier

Open markkahn opened this issue 6 years ago • 0 comments

Apparently sending a dropdown+actions without a close label is forbidden!

notifier.notify({title: 'test', message: 'this is a test', actions: ['foo', 'bar'], wait:true, dropdownLabel: 'click me!', reply:true}, console.log.bind(console));

yields:

{ Error: Command failed: /Users/mark/VoiceNGO/node_modules/node-notifier/vendor/terminal-notifier.app/Contents/MacOS/terminal-notifier -title "test" -message "this is a test" -actions foo,bar -dropdownLabel "click me!" -reply "true" -timeout "5" -json "true"
2018-03-20 14:01:21.519 terminal-notifier[4807:142160] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndexedSubscript:]: index 9223372036854775807 beyond bounds [0 .. 1]'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff533542fb __exceptionPreprocess + 171
	1   libobjc.A.dylib                     0x00007fff79cc3c76 objc_exception_throw + 48
	2   CoreFoundation                      0x00007fff533957b4 _CFThrowFormattedException + 202
	3   CoreFoundation                      0x00007fff53405ff1 -[__NSArrayI objectAtIndexedSubscript:] + 97
	4   terminal-notifier                   0x0000000105ec1329 -[AppDelegate userNotificationCenter:didActivateNotification:] + 558
	5   Foundation                          0x00007fff556551cc -[_NSConcreteUserNotificationCenter _sendDelegateMessage:sendToAppDelegate:withObject:] + 135
	6   Foundation                          0x00007fff5565544c -[_NSConcreteUserNotificationCenter _notificationClickedMessage:] + 573
	7   Foundation                          0x00007fff55655ac6 __54-[_NSConcreteUserNotificationCenter _serverConnection]_block_invoke.275 + 287
	8   libdispatch.dylib                   0x00007fff7a8806cd _dispatch_call_block_and_release + 12
	9   libdispatch.dylib                   0x00007fff7a878e88 _dispatch_client_callout + 8
	10  libdispatch.dylib                   0x00007fff7a884471 _dispatch_main_queue_callback_4CF + 1148
	11  CoreFoundation                      0x00007fff5330c9c9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
	12  CoreFoundation                      0x00007fff532cec4a __CFRunLoopRun + 2586
	13  CoreFoundation                      0x00007fff532cdfa3 CFRunLoopRunSpecific + 483
	14  HIToolbox                           0x00007fff525ed866 RunCurrentEventLoopInMode + 286
	15  HIToolbox                           0x00007fff525ed5d6 ReceiveNextEventCommon + 613
	16  HIToolbox                           0x00007fff525ed354 _BlockUntilNextEventMatchingListInModeWithFilter + 64
	17  AppKit                              0x00007fff508eaa23 _DPSNextEvent + 2085
	18  AppKit                              0x00007fff5107fe6c -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 3044
	19  AppKit                              0x00007fff508df831 -[NSApplication run] + 764
	20  AppKit                              0x00007fff508ae9d2 NSApplicationMain + 804
	21  libdyld.dylib                       0x00007fff7a8b2145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

    at ChildProcess.exithandler (child_process.js:273:12)
    at ChildProcess.emit (events.js:180:13)
    at ChildProcess.emit (domain.js:439:23)
    at maybeClose (internal/child_process.js:936:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
  killed: false,
  code: null,
  signal: 'SIGABRT',
  cmd: '/Users/mark/VoiceNGO/node_modules/node-notifier/vendor/terminal-notifier.app/Contents/MacOS/terminal-notifier -title "test" -message "this is a test" -actions foo,bar -dropdownLabel "click me!" -reply "true" -timeout "5" -json "true"' } '' {}

I realize this is probably fundamentally Apple's problem, but the tool should probably add a sanity check for cases like this

markkahn avatar Mar 20 '18 06:03 markkahn