Thanks you for clicking on this question. I am trying to restart a nodeJS process, without external libraries. I did this code:
function restartProcess() {
spawn(process.argv[1], process.argv.slice(2), {
detached: true,
stdio: ['ignore', out, err]
}).unref()
process.exit()
}
bot.on( "kicked", (reason) => {
console.log("KICKED! "+ reason)
restartProcess()
})
But, when restartProcess() is called, i get error:
C:\Users\Toshiba\Desktop\program\mineflayer\spbot\bot.js:7
stdio: ['ignore', out, err]
^
ReferenceError: out is not defined
at restartProcess (C:\Users\Toshiba\Desktop\program\mineflayer\spbot\bot.js:7:25)
at EventEmitter.<anonymous> (bot.js:54:5)
at EventEmitter.emit (events.js:315:20)
at Client.<anonymous> (C:\Users\Toshiba\node_modules\mineflayer\lib\plugins\kick.js:5:9)
at Client.emit (events.js:315:20)
at FullPacketParser.<anonymous> (C:\Users\Toshiba\node_modules\minecraft-protocol\src\client.js:89:12)
at FullPacketParser.emit (events.js:315:20)
at addChunk (C:\Users\Toshiba\node_modules\readable-stream\lib\_stream_readable.js:298:12)
at readableAddChunk (C:\Users\Toshiba\node_modules\readable-stream\lib\_stream_readable.js:280:11)
at FullPacketParser.Readable.push (C:\Users\Toshiba\node_modules\readable-stream\lib\_stream_readable.js:241:10)
Any help would be VERY appreciated!