fix(text): support piped messages on Windows

- use the standard input file descriptor instead of /dev/stdin
- reuse the shared file-or-stdin reader in text chat
This commit is contained in:
若麒
2026-07-16 16:42:32 +08:00
parent 88fcda62aa
commit 1fbafa8b1d
4 changed files with 7 additions and 5 deletions
+3 -1
View File
@@ -1,5 +1,7 @@
import { readFileSync } from "fs";
const STDIN_FILE_DESCRIPTOR = 0;
export function readTextFromPathOrStdin(path: string): string {
return readFileSync(path === "-" ? "/dev/stdin" : path, "utf-8");
return readFileSync(path === "-" ? STDIN_FILE_DESCRIPTOR : path, "utf-8");
}
+1
View File
@@ -2,6 +2,7 @@ export { generateFilename } from "./filename.ts";
export { resolveOutputDir } from "./output-dir.ts";
export { maskToken } from "./token.ts";
export { stripUndefined } from "./object.ts";
export { readTextFromPathOrStdin } from "./fs.ts";
export {
parseBooleanValue,
parseOptionalBooleanValue,