+ let aggregatedLogs = ''
+
+ this.app = fork(join(root(), 'dist', 'server.js'), options.peertubeArgs || [], forkOptions)
+
+ const onPeerTubeExit = () => rej(new Error('Process exited:\n' + aggregatedLogs))
+ const onParentExit = () => {
+ if (!this.app || !this.app.pid) return
+
+ try {
+ process.kill(self.app.pid)
+ } catch { /* empty */ }
+ }
+
+ this.app.on('exit', onPeerTubeExit)
+ process.on('exit', onParentExit)