fix(daemon): Improve daemon log delivery and process monitor memory accounting; gate debug output and update tests to numeric ProcessId
This commit is contained in:
@@ -90,9 +90,19 @@ export class ProcessWrapper extends EventEmitter {
|
||||
|
||||
// Capture stdout
|
||||
if (this.process.stdout) {
|
||||
console.error(`[ProcessWrapper] Setting up stdout listener for process ${this.process.pid}`);
|
||||
if (process.env.TSPM_DEBUG) {
|
||||
console.error(
|
||||
`[ProcessWrapper] Setting up stdout listener for process ${this.process.pid}`,
|
||||
);
|
||||
}
|
||||
this.process.stdout.on('data', (data) => {
|
||||
console.error(`[ProcessWrapper] Received stdout data from PID ${this.process?.pid}: ${data.toString().substring(0, 100)}`);
|
||||
if (process.env.TSPM_DEBUG) {
|
||||
console.error(
|
||||
`[ProcessWrapper] Received stdout data from PID ${this.process?.pid}: ${data
|
||||
.toString()
|
||||
.substring(0, 100)}`,
|
||||
);
|
||||
}
|
||||
// Add data to remainder buffer and split by newlines
|
||||
const text = this.stdoutRemainder + data.toString();
|
||||
const lines = text.split('\n');
|
||||
@@ -102,7 +112,9 @@ export class ProcessWrapper extends EventEmitter {
|
||||
|
||||
// Process complete lines
|
||||
for (const line of lines) {
|
||||
console.error(`[ProcessWrapper] Processing stdout line: ${line}`);
|
||||
if (process.env.TSPM_DEBUG) {
|
||||
console.error(`[ProcessWrapper] Processing stdout line: ${line}`);
|
||||
}
|
||||
this.logger.debug(`Captured stdout: ${line}`);
|
||||
this.addLog('stdout', line);
|
||||
}
|
||||
|
Reference in New Issue
Block a user