How to make Item notify you when webpack is done bundling? - notifications

I know how to enable the notification on iterm such that when command are done running, a notification is sent to the user. How can I apply this strategy for webpack bundling or other long-running processes that streams a series of success / failure and other logging informations?

Related

Sending notifications on build start in Bamboo server

I'm looking to be able to send notification whenever a build is started and not only when they are completed.
Is there a way to get custom Notification Events?
There is not a native way to do this. However, there are some creative ways to get around this:
Use a task in a build job to send out the notification via a script or executable (my recommendation).
Use webhooks and 3rd party applications (e.g., Slack, Microsoft Teams)
Use the Bamboo API + a custom script to watch for the build to start.

How can PhantomJS communicate through RabbitMQ?

I am new to RabbitMQ. I work with PhantomJS and use JavaScript to do stuff. Now, I need to send some of my results to the RabbitMQ in order to read them using another script. I mean, I want PhantomJS to communicate with RabbitMQ. To send some messages and to read some messages from the queue. Is that possible? Is there anyway by which PhantomJS can communicate with RabbitMQ?
PhantomJS is just another browser. That's exactly what the RabbitMQ Web-Stomp Plugin is for. It is based on SockJS which provides a web socket connection between browser and server. If web sockets are not available there are cross-browser fallbacks. PhantomJS supports web sockets from version 2 onwards.
If you don't open a page in PhantomJS, then you need to run this with the --local-to-remote-url-access=true option. I assume that sockjs-0.3.js and stomp.js are in the scripts directory.
page.injectJs('sockjs-0.3.js');
page.injectJs('stomp.js');
page.evaluate(function(){
var ws = new SockJS('http://127.0.0.1:15674/stomp');
window.client = Stomp.over(ws);
...
});
This has to run in the page context (inside of page.evaluate()). So that is why client is a global window property so that you can get a reference to the client with subsequent page.evaluate() calls. You can trigger calls from the page context to the outside by using window.callPhantom() and the page.onCallback event handler.

How to Turn Off Automatic Termination of Suspended Apps

I'm trying to debug my Windows Store App when it gets suspended (trying to prevent my server app from kicking my WSA client when it gets suspended and stops responding to keep-alive messages). But Windows keeps terminating my app almost immediately after it suspends it. Is there a way to prevent Windows from terminating suspended apps? I've searched the interwebs and the group policy editor for such a setting, but the best I can find is a setting to prevent it from auto-terminating apps on shutdown, which doesn't help me. And of course running in the debugger and pressing the Suspend button doesn't help either, since the app doesn't actually get suspended. I guess I could hack in some debug code to make it pretend to be suspended, but I'd prefer not to.
The command line tool PLMDebug, which is part of the Debugging Tools for Windows package, can be used to exempt an app from the Process Lifetime Management (PLM) policies. When put into debug mode, an app will not be subject to termination and will not be automatically suspended.
Usage:
plmdebug /enableDebug <PackageFullName> [OptionalDebuggerCommandLine]
Once you've exempted it from PLM automatic suspension and termination, you can use /suspend to force a manual suspension.

Background js doesn't work on error pages

Is there any way to load background js even on error pages (such as net::ERR_NETWORK_CHANGED)? I need to keep persistence connection with WS server from the extension, but error pages don't load background js. So I lose the connection and possibility to restart it (due this is automated tool without access to browser ui).
The only solution I found is to use proxy server to customize error pages and load background js inside of them.
The assertion "Background js doesn't work on error pages" does not make any sense, because there's only one background page per extension two if you use split incognito mode.
So I assume that you want to detect a network connectivity loss in order to restore the web socket. Chrome offers two reliable global events for this: online and offline.
I have published the source code of Real-time desktop notifications for Stack Exchange inbox, which also accounts for network connectivity loss/regain. The relevant Web Socket part of the Chrome extension is found in stackexchange-notifications/Chrome/using-websocket.js on Github.

How to monitor a process on OS X?

I am looking for a way to monitor the state of one of my applications on OS X. There's a number of components that I need to monitor such as the status of various communication channels. If they go down, the monitoring process should be able to warn the user both on screen and via a push notification.
XPC services look promising, but if the app crashes, I presume this will take out the service as well, or am I mistaken?
My preferred solution is something which would also monitor for unexpected termination, and restart the app if it happens.
What is the best way to do this?
I think monitoring communication channels, etc. must be done by the each specific components (processes). And if the unexpected error occur that component should exit immediately to ensure proper cleanup.
For processe monitoring, below Apple Technical Q&A document will be really helpful:
Technical Note TN2050: Observing Process Lifetimes Without Polling
You could write an app which starts your main application as a child process, and waits for it to exit. It could check the exit code, and then react according to your needs.
This approach is explained here: https://stackoverflow.com/a/78095/785411
To fork() some monitoring process to run your main application as a child process, this is explained here: https://stackoverflow.com/a/4327062/785411
I think you could possibly make use of the built in facilities Launchd and CrashReporter to achieve your requirements.
Launchd is the OS X system supervisor intended for launching and monitoring background processes, and would be typically used to run XPC services. Launchd agents can react to various system events, and can be configured to restart processes in the event of them crashing ( specified via the KeepAlive/SuccessfulExit key in the property list)
Launchd can be set to react to various system events as launch event, including monitoring files and directories, scheduled times, or listening to network connections.
CrashReporter is the OS X system facility that catches and logs all process crashes. It logs through the AppleSystemLogger facility and can be accessed with the syslog tools as documented in the linked TechNote. On Mountain Lion, user process crash reports end up in ~/Library/DiagnosticReports/ , with a crashlog and plist file pair created per crash event.
I think you could use these features in a couple of ways to achieve your requirement, if launchd is responsible for running the xpc services, it can take reponsibility for restarting them on crash events, and they can be dissociated from any app crashes.
You could write a launchd agent that responds to for crash events by montioring the crash report directory (e.g. using the QueueDirectories property) for new logs and re-launches your applicaton, or presents notifications.
If each process runs in its own thread you could run a watchdog program that monitors whether the threads are alive. A script that runs ps in a loop and parses the output could do it.
You can see the various options here. See for example -C to select by command name, and -m to show all threads.