mirror of
https://github.com/unraid/api.git
synced 2026-01-04 23:50:37 -06:00
fix: set cwd to __dirname and add logs
This commit is contained in:
18
index.js
18
index.js
@@ -2,12 +2,19 @@ const path = require('path');
|
||||
const cluster = require('cluster');
|
||||
|
||||
// Show real stack trace in development
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
require('source-map-support').install({
|
||||
handleUncaughtExceptions: false
|
||||
});
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
try {
|
||||
require('source-map-support').install({
|
||||
handleUncaughtExceptions: false
|
||||
});
|
||||
} catch {
|
||||
console.error(`Could not load "source-map-supoort", do you have it installed?`);
|
||||
}
|
||||
}
|
||||
|
||||
// Set current working directory
|
||||
process.chdir(__dirname);
|
||||
|
||||
const RESTART_ATTEMPTS = 10;
|
||||
let currentRestartAttempt = 0;
|
||||
|
||||
@@ -43,7 +50,8 @@ if (cluster.isWorker) {
|
||||
|
||||
try {
|
||||
require(mainPath);
|
||||
} catch {
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
console.error(`Could not load main field "${mainPath}".`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user