mirror of
https://github.com/modelstudioai/cli.git
synced 2026-09-14 19:49:23 +08:00
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:
@@ -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");
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user