natureco-cli 1.0.31 ā 1.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -48,6 +48,9 @@ function log(module, message, color = 'white') {
|
|
|
48
48
|
async function gatewayServer(action) {
|
|
49
49
|
// Check if running as background worker
|
|
50
50
|
if (process.argv.includes('--gateway-worker')) {
|
|
51
|
+
process.stdin.resume();
|
|
52
|
+
process.title = 'natureco-gateway';
|
|
53
|
+
log('gateway', 'Worker process started, PID: ' + process.pid);
|
|
51
54
|
return runGatewayWorker();
|
|
52
55
|
}
|
|
53
56
|
|
|
@@ -90,17 +93,25 @@ async function startGateway() {
|
|
|
90
93
|
|
|
91
94
|
console.log(chalk.green('\nš Starting NatureCo Gateway...\n'));
|
|
92
95
|
|
|
96
|
+
// Ensure log directory exists
|
|
97
|
+
const dir = path.dirname(LOG_FILE);
|
|
98
|
+
if (!fs.existsSync(dir)) {
|
|
99
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Open log file for stdio redirection
|
|
103
|
+
const logFile = fs.openSync(LOG_FILE, 'a');
|
|
104
|
+
|
|
93
105
|
// Start as detached background process
|
|
94
106
|
const child = spawn(process.execPath, [__filename, '--gateway-worker'], {
|
|
95
107
|
detached: true,
|
|
96
|
-
stdio: 'ignore',
|
|
108
|
+
stdio: ['ignore', logFile, logFile],
|
|
97
109
|
windowsHide: true,
|
|
98
110
|
});
|
|
99
111
|
|
|
100
112
|
child.unref();
|
|
101
113
|
|
|
102
114
|
// Save PID
|
|
103
|
-
const dir = path.dirname(PID_FILE);
|
|
104
115
|
if (!fs.existsSync(dir)) {
|
|
105
116
|
fs.mkdirSync(dir, { recursive: true });
|
|
106
117
|
}
|