dynamicdan / sn-filesync

2-way sync ServiceNow field values to local files
MIT License
66 stars 37 forks source link

osx-notifier crash #9

Closed jlignier closed 9 years ago

jlignier commented 9 years ago

Hey mate, FileSync regularly crashes when syncing a newly created record. I'm running OSX Yosemite. The following was outputted to the command window after syncing a Style Sheet record:

10:29:04 - info: Files left in queue: 0 execFile(/Users/joellignier/Desktop/filesync/node_modules/osx-notifier/osx/terminal-notifier-info.app/Contents/MacOS/terminal-notifier) terminal-notifier (1.5.0) is a command-line tool to send OS X User Notifications.

Usage: terminal-notifier -[message|list|remove] [VALUE|ID|ID] [options]

Either of these is required:

   -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.
   -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.
   -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.

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

/Users/joellignier/Desktop/filesync/node_modules/osx-notifier/index.js:41 throw err; ^ Error: Command failed: at ChildProcess.exithandler (child_process.js:548:15) at ChildProcess.EventEmitter.emit (events.js:99:17) at maybeClose (child_process.js:646:16) at Socket.ChildProcess.spawn.stdin (child_process.js:823:11) at Socket.EventEmitter.emit (events.js:96:17) at Socket._destroy.destroyed (net.js:358:10) at process.startup.processNextTick.process._tickCallback (node.js:245:9) logout

[Process completed]

dynamicdan commented 9 years ago

What version of FileSync where you using to cause this error? I can't re-create it. I have seen this error in the past and fixed it. It's a result of the osx-notifier module not getting enough parameters. If you would like to debug further, simply put some console.log(...) statements around line 124 in src/notify.js. Eg.

        if (isMac) {
            console.log('checking args...');
            console.log(notifyArgs);
            //notify(notifyArgs);
        } else {
            // windows support?
            // linux support?
        }
jlignier commented 9 years ago

Here's the output:

checking args... { type: 'pass', title: 'Download Complete', subtitle: '', message: '(KeySite) Base Styles (content_css:style)', open: 'https://removedinstancename.service-now.com/content_css.do?sysparm_query=name=(KeySite)%20Base%20Styles' }

I suspect the crash is happening because I often use brackets in the record name.

dynamicdan commented 9 years ago

Yep. I can confirm it's the curved brackets causing the issue with the osx-notifier app. I added an issue here: chbrown/osx-notifier/issues/1

I also have a workaround for now that I will add shortly.

jlignier commented 9 years ago

Tested and the FileSync is no longer crashing. Thanks for fixing this up.