File tree 1 file changed +16
-3
lines changed
1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -237,11 +237,24 @@ forever.startDaemon = function (script, options) {
237
237
// **NOTE:** This will change your `process.title`.
238
238
//
239
239
forever . startServer = function ( ) {
240
- var monitors = Array . prototype . slice . call ( arguments ) ,
241
- callback = typeof monitors [ monitors . length - 1 ] == 'function' && monitors . pop ( ) ,
240
+ var args = Array . prototype . slice . call ( arguments ) ,
242
241
socket = path . join ( forever . config . get ( 'sockPath' ) , 'forever.sock' ) ,
242
+ monitors = [ ] ,
243
+ callback ,
243
244
server ;
244
-
245
+
246
+ args . forEach ( function ( a ) {
247
+ if ( Array . isArray ( a ) ) {
248
+ monitors = monitors . concat ( a . filter ( function ( m ) { return m instanceof forever . Monitor } ) ) ;
249
+ }
250
+ else if ( a instanceof forever . Monitor ) {
251
+ monitors . push ( a ) ;
252
+ }
253
+ else if ( typeof a === 'function' ) {
254
+ callback = a ;
255
+ }
256
+ } ) ;
257
+
245
258
server = net . createServer ( function ( socket ) {
246
259
//
247
260
// Write the specified data and close the socket
You can’t perform that action at this time.
0 commit comments