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

How to debug for OSX #70

Closed
unphased opened this issue Feb 21, 2015 · 13 comments
Closed

How to debug for OSX #70

unphased opened this issue Feb 21, 2015 · 13 comments

Comments

@unphased
Copy link

When I run gulp it leaves as many terminal-notifier processes running as there are files (such as CSS and JSX files) being processed, and there are a lot of them... Sometimes this precipitates "out of available file handles" issues with the operating system. It would appear (Just shooting from the hip here) that every time I edit and save a file some new process is spawned and failed to be cleaned -- after a nice heavy hack session of hundreds of file saves, something is bound to break.

So I have been using DISABLE_NOTIFIER=true gulp instead, which seems to not leave a billion terminal-notifiers hanging around. But this is not ideal because i can no longer see the messages that show me which files have just been changed (and just generally what gulp is up to).

So I was hoping that someone here could help show me how I could get started troubleshooting what went wrong with my project's setup. Also possible is that i need to look at overall gulp config not just anything specific to gulp-notify.

@mikaelbr
Copy link
Owner

gulp-notify will create a notification for each of the files which are piped to it. If you pipe 100 vinyl files to it, it will create 100 notifications. You can choose to just emit once per stream though, by using the onLast-setting: https://github.com/mikaelbr/gulp-notify#optionsonlast

Hope that helps?

@unphased
Copy link
Author

Well heres the other thing is that a few months ago I did see gulp generating system notifications when it was doing stuff, but none of that is happening now. I get zero system notifications, and these terminal-notifier processes are just piling up. At any rate, my assumption was that this amount of cannot possibly be expected behavior, okay spawn 300 notifications, that's fine but don't consume 1500MB of RAM for it...

I'll look into that option, thanks.

@mikaelbr
Copy link
Owner

Usually you would use gulp-notify after doing some minification/concatination, so you would only pipe one file.

@unphased
Copy link
Author

I still wanna see the messages for each file though. Is there a way to make a config option that disables the notification but still shows the per-file message?

@mikaelbr
Copy link
Owner

Ah, so you want to show message in terminal, but not get notification in Notification Center? I think the best way for that is to simply log the files.

Something like this:

gulp.src('./**/*.js')
  // .pipe(somePlugin()) // do something with stream
  .on('data', function (file) {
   console.log('File: ', file.relative);
  });

You can make it prettier using something like https://github.com/sindresorhus/chalk or use gutils.log (though I think that might be deprecated in time).

@unphased
Copy link
Author

I find that running terminal-notifier like this:

./node_modules/node-notifier/vendor/terminal-notifier.app/Contents/MacOS/terminal-notifier -
message 'test'

it just hangs, leaving a process consuming 5+MB of RAM. This is the root of the issue. So a workaround in here or gulp to not use terminal-notifier would allow me to circumvent this.

@mikaelbr
Copy link
Owner

That's weird. Does it go away in time (i.e. ~30 seconds)?

@unphased
Copy link
Author

No, it never returns. I am supposed to get a system notification with the content "test", which I conspicuously also do not receive.

@mikaelbr
Copy link
Owner

And you see no notification?

@unphased
Copy link
Author

Right. It's quite clearly borked.

@unphased
Copy link
Author

I tried something like the snippet you suggested, what it receives inside on() is a raw nodejs file object for the file content. Which is.... nice? But I rather like the nice colored templatable message i set for the notify options...

I guess I ought to try to make the terminal-notifier actually work. That would solve my issue.

@unphased
Copy link
Author

julienXX/terminal-notifier#115

This is the issue. It actually works when not under tmux.

Solved. Thanks for helping.

@mikaelbr
Copy link
Owner

Thanks for figuring it out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants