We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
spawn
1 parent 768f074 commit 831f76fCopy full SHA for 831f76f
lib/forever/worker.js
@@ -44,6 +44,23 @@ Worker.prototype.start = function (cb) {
44
socket.data(['data'], function () {
45
socket.send(['data'], self.monitor.data);
46
});
47
+
48
+ socket.data(['spawn'], function (data) {
49
+ if (!data.script) {
50
+ return socket.send(['spawn', 'error'], { error: new Error('No script given') });
51
+ }
52
53
+ if (this.monitor) {
54
+ return socket.send(['spawn', 'error'], { error: new Error("Already running") });
55
56
57
+ var monitor = new (forever.Monitor)(data.script, data.options);
58
+ monitor.start();
59
60
+ monitor.on('start', function () {
61
+ socket.send(['spawn', 'start']);
62
+ });
63
64
65
66
findSocket(self.sockPath, function (err, sock) {
0 commit comments