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

Command Failed on Windows with wait: true #97

Closed
MadLittleMods opened this issue Feb 7, 2016 · 10 comments
Closed

Command Failed on Windows with wait: true #97

MadLittleMods opened this issue Feb 7, 2016 · 10 comments

Comments

@MadLittleMods
Copy link
Collaborator

Related to #33

I am running node-notifier inside nw.js v0.12.3 on Windows 10.

The notification pops without a problem and you can even start multiple notifications but it seems that after the first notification times out, the app will crash.

This only happens when wait: true. Keeping it as as false, doesn't cause any crashes and doesn't seem to limit any functionality.

index.js:28 Caught exception: Error: Command failed: C:\Users\MLM\AppData\Local\Temp\nw17184_28\node_modules\node-notifier\vendor\toaster\toast.exe -sound false -p file://C:\Users\MLM\AppData\Local\Temp\s-11617-11904-ohnmpb -m a -t EricTroupeTester @ MadLittleMods/asdf1234 -q true -w true
    index.js:28 (anonymous function)
    events.js:80
    emitOneevents.js:150
    emitnode.js:256
    process._fatalException

index.js:29 Error: Command failed: C:\Users\MLM\AppData\Local\Temp\nw17184_28\node_modules\node-notifier\vendor\toaster\toast.exe -sound false -p file://C:\Users\MLM\AppData\Local\Temp\s-11617-11904-ohnmpb -m a -t EricTroupeTester @ MadLittleMods/asdf1234 -q true -w true

    at ChildProcess.exithandler (child_process.js:716)
    at emitTwo (events.js:85)
    at ChildProcess.emit (events.js:153)
    at maybeClose (child_process.js:984)
    at Process.ChildProcess._handle.onexit (child_process.js:1057)index.js:29 (anonymous function)events.js:80 emitOneevents.js:150 emitnode.js:256 process._fatalException

You can see the source code here:
https://github.com/gitterHQ/desktop/pull/100/files#diff-d74e5f0a212623b40b7c84b3d6313d78R49

@MadLittleMods MadLittleMods changed the title Command Failed on Windows with wait: false Command Failed on Windows with wait: true Feb 7, 2016
@mikaelbr
Copy link
Owner

mikaelbr commented Feb 8, 2016

Thanks for your issue! I'll look into it

@MadLittleMods
Copy link
Collaborator Author

Note that the error comes from the callback:

notifier.notify({
  title: opts.title,
  message: opts.message,
  // wait with callback until user action is taken on notification
  wait: true
}, function(err, response) {
  if(err) {
    console.log(err, err.stack);
  }
});

Here is a slightly better stacktrace that has some references into the node-notifer code:

Error
    cmd: "C:\Users\MLM\AppData\Local\Temp\nw13016_25400\node_modules\node-notifier\vendor\toaster\toast.exe -sound false -p C:\Users\MLM\AppData\Local\Temp\gitter-notification-avatars_\116123-10160-e4vl6c -m afwe -t MadLittleMods @ MadLittleMods/asdf1234 -q true -w true"
    code: 3
    killed: false
    message: "Command failed: C:\Users\MLM\AppData\Local\Temp\nw13016_25400\node_modules\node-notifier\vendor\toaster\toast.exe -sound false -p C:\Users\MLM\AppData\Local\Temp\gitter-notification-avatars_\116123-10160-e4vl6c -m afwe -t MadLittleMods @ MadLittleMods/asdf1234 -q true -w true↵"
    signal: null

Error: Command failed: C:\Users\MLM\AppData\Local\Temp\nw13016_25400\node_modules\node-notifier\vendor\toaster\toast.exe -sound false -p C:\Users\MLM\AppData\Local\Temp\gitter-notification-avatars_\116123-10160-e4vl6c -m afwe -t MadLittleMods @ MadLittleMods/asdf1234 -q true -w true

    at ChildProcess.exithandler (child_process.js:716:12)
    at emitTwo (events.js:85:13)
    at ChildProcess.emit (events.js:153:7)
    at maybeClose (child_process.js:984:16)
    at Process.ChildProcess._handle.onexit (child_process.js:1057:5)C:\Users\MLM\AppData\Local\Temp\nw13016_25400\utils\notifier.js:138
        (anonymous function) C:\Users\MLM\AppData\Local\Temp\nw13016_25400\node_modules\node-notifier\lib\utils.js:165
        (anonymous function) C:\Users\MLM\AppData\Local\Temp\nw13016_25400\node_modules\node-notifier\lib\utils.js:53
        (anonymous function) child_process.js:723
        exithandler events.js:85
        emitTwo events.js:153
        emit child_process.js:984
        maybeClose child_process.js:1057
        ChildProcess._handle.onexit

@Siecje
Copy link

Siecje commented Mar 13, 2016

On Windows 10, I'm trying to create a notification that doesn't disappear until it is closed.

with wait: true it closes and there is an error in the console.

Error: Command failed: node_modules\node-notifier\vendor\toaster\toast.exe -m Hello -t Node Notification: -q true -w true(…) "Timeout

@black-snow
Copy link

black-snow commented Jun 15, 2016

@mikaelbr I can confirm this. Is there any workaround to make sticky notifications until this is fixed? I'd like to help but sadly it seems like the error arises from toast.exe.

// edit: I also tried WindowsBalloon without fallbacks. There's no error poppin' with this but it's not sticky as well (wait:true). The Balloon just disappears after ~5 seconds. notifu docs say that it's not guaranteed to stay alive for the given time :( --- maybe the wait-option should be removed from WindowsBalloon. Just checked it, /d 0 won't keep the bubble up - it's the same as leaving /d out.

@black-snow
Copy link

I'm somewhat getting around this by checking if error.code == 3 && error.killed == false && error.toString().indexOf('Command failed') > -1 and then firing another notification or executing some user-was-too-slow-action. Would love to see a fix anyway.

@djpereira
Copy link

Same issue here with Windows 10 trying to use the wait: true option. I have a similar stack trace.

Error: Command failed: C:\src\ElectronExample4\node_modules\node-notifier\vendor\toaster\toast.exe -p C:\src\ElectronExample4\image\favicon.png -m Notification Message -t Notification Title -w true(…) "Error: Command failed: C:\src\ElectronExample4\node_modules\node-notifier\vendor\toaster\toast.exe -p C:\src\ElectronExample4\image\favicon.png -m Notification Message -t Notification Title -w true

    at ChildProcess.exithandler (child_process.js:214:12)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:852:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)"

@SavageCore
Copy link

I am also failing to get 'sticky' toasts on Windows 10 and 7

Is nels-o/toaster#2 relevant to this?

7 returns null error

10 same as @djpereira

@samjulien
Copy link

I'm still having this issue when using gulp-notify, which is using node-notifier 4.6.1. I'm on Windows 10, node 6.9.1, and npm 3.10.8. Usage is like this:

var eventMessage = 'File ' + event.path + ' was ' + event.type + ', running tasks...';
        return gulp.src('').pipe(plug.notify({
            onLast: true,
            message: eventMessage
        }));

Error is:

Message:
    Command failed: C:\Users\sam_julien\Source\Repos\PT-UI\PT_UI\node_modules\gulp-notify\node_modules\node-notifier\vendor\toaster\toast.exe -onLast true -p C:\Users\sam_julien\Source\Repos\PT-UI\PT_UI\node_modules\gulp-notify\assets\gulp.png -m File C:\Users\sam_julien\Source\Repos\PT-UI\PT_UI\code\app\contractors\contractor-service.js was changed, running tasks... -t Gulp notification -q true
Unhandled Exception: System.IO.DirectoryNotFoundException: The system cannot find the path specified. (Exception from HRESULT: 0x80070003)
   at ShellHelpers.IPersistFile.Save(String pszFileName, Boolean fRemember)
   at toast.Program.InstallShortcut(String shortcutPath)
   at toast.Program.TryCreateShortcut()
   at toast.Program.Main(String[] args)

Removing the onLast and only passing in the message didn't change anything. Any ideas?

@mikaelbr
Copy link
Owner

How does this work now in master branch when switching toaster. Could someone please test out by doing:

npm i mikaelbr/node-notifier

@mikaelbr
Copy link
Owner

Closing this as we've switched toaster implementation.

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

8 participants