tycono 0.1.96-beta.58 → 0.1.96-beta.59
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/bin/tycono.ts +11 -4
- package/package.json +1 -1
package/bin/tycono.ts
CHANGED
|
@@ -221,15 +221,22 @@ async function startServerForTui(): Promise<void> {
|
|
|
221
221
|
const origStdoutWrite = process.stdout.write.bind(process.stdout);
|
|
222
222
|
const origLog = (...args: unknown[]) => origStdoutWrite(args.join(' ') + '\n');
|
|
223
223
|
|
|
224
|
-
// Redirect console
|
|
225
|
-
// ⛔ Do NOT redirect process.
|
|
226
|
-
// stdout.write: Ink needs full control for rendering
|
|
227
|
-
// stderr.write: Node.js http client uses it internally — redirect breaks HTTP
|
|
224
|
+
// Redirect console + stdout.write to suppress server logs
|
|
225
|
+
// ⛔ Do NOT redirect process.stderr.write — breaks Node.js http client
|
|
228
226
|
console.log = (...a: unknown[]) => { logStream.write(a.join(' ') + '\n'); };
|
|
229
227
|
console.error = (...a: unknown[]) => { logStream.write(a.join(' ') + '\n'); };
|
|
230
228
|
console.warn = (...a: unknown[]) => { logStream.write(a.join(' ') + '\n'); };
|
|
231
229
|
console.info = (...a: unknown[]) => { logStream.write(a.join(' ') + '\n'); };
|
|
232
230
|
|
|
231
|
+
// Intercept stdout.write — allow Ink (ANSI), redirect server text to log
|
|
232
|
+
const isInkOutput = (s: string) => s.includes('\x1b[') || s.includes('\x1b(');
|
|
233
|
+
process.stdout.write = ((chunk: any, ...args: any[]) => {
|
|
234
|
+
const str = typeof chunk === 'string' ? chunk : chunk.toString();
|
|
235
|
+
if (isInkOutput(str)) return origStdoutWrite(chunk, ...args);
|
|
236
|
+
logStream.write(str);
|
|
237
|
+
return true;
|
|
238
|
+
}) as any;
|
|
239
|
+
|
|
233
240
|
const { createHttpServer } = await import('../src/api/src/create-server.js');
|
|
234
241
|
const server = createHttpServer();
|
|
235
242
|
|