exit forked process after PIPE is closed #917 #915

This commit is contained in:
Jan Prochazka
2024-10-15 09:41:02 +02:00
parent f05c60c628
commit b631519009

View File

@@ -4,11 +4,16 @@ const fs = require('fs');
const moment = require('moment');
const path = require('path');
const { logsdir, setLogsFilePath, getLogsFilePath } = require('./utility/directories');
const platformInfo = require('./utility/platformInfo');
const logger = getLogger('apiIndex');
process.on('uncaughtException', err => {
logger.fatal(extractErrorLogData(err), 'Uncaught exception');
if (err?.['code'] == 'EPIPE' && platformInfo.isForkedApi) {
// stop subprocess on EPIPE errors
process.exit(0);
}
});
if (processArgs.startProcess) {