@@ -179,12 +179,13 @@ module.exports = class InteractorDaemonizer {
179
179
const err = testEnv ? 2 : fs . openSync ( constants . INTERACTOR_LOG_FILE_PATH , 'a' )
180
180
181
181
let binary = process . execPath
182
- if ( binary . indexOf ( 'node' ) === - 1 ) {
182
+
183
+ if ( cst . IS_BUN === true )
184
+ binary = process . execPath
185
+ else if ( binary . indexOf ( 'node' ) === - 1 )
183
186
binary = 'node'
184
- }
185
- if ( process . env . NODEJS_EXECUTABLE ) {
187
+ if ( process . env . NODEJS_EXECUTABLE )
186
188
binary = process . env . NODEJS_EXECUTABLE
187
- }
188
189
189
190
const child = childProcess . spawn ( binary , [ InteractorJS ] , {
190
191
silent : false ,
@@ -201,7 +202,8 @@ module.exports = class InteractorDaemonizer {
201
202
PM2_VERSION : conf . pm2_version ,
202
203
DEBUG : process . env . DEBUG || 'interactor:*,-interactor:axon,-interactor:websocket,-interactor:pm2:client,-interactor:push'
203
204
} , process . env ) ,
204
- stdio : [ 'ipc' , out , err ]
205
+ stdio : [ null , out , err , 'ipc' ] , // Redirect stdout, stderr, and enable IPC
206
+ //stdio: ['ipc', out, err]
205
207
} )
206
208
207
209
try {
@@ -222,6 +224,7 @@ module.exports = class InteractorDaemonizer {
222
224
if ( status === constants . ERROR_EXIT ) {
223
225
return cb ( new Error ( 'Agent has shutdown for unknown reason' ) )
224
226
}
227
+
225
228
return cb ( )
226
229
} )
227
230
@@ -235,7 +238,8 @@ module.exports = class InteractorDaemonizer {
235
238
const timeout = setTimeout ( _ => {
236
239
printOut ( `${ chalk . yellow ( '[PM2.IO][WARNING]' ) } Not managed to connect to PM2 Plus, retrying in background.` )
237
240
child . removeAllListeners ( )
238
- child . disconnect ( )
241
+ if ( child . disconnect )
242
+ child . disconnect ( )
239
243
return cb ( null , { } , child )
240
244
} , 7000 )
241
245
@@ -248,6 +252,8 @@ module.exports = class InteractorDaemonizer {
248
252
}
249
253
250
254
child . removeAllListeners ( 'error' )
255
+ if ( cst . IS_BUN === true )
256
+ child . removeAllListeners ( 'close' )
251
257
child . disconnect ( )
252
258
253
259
// Handle and show to user the different error message that can happen
0 commit comments