fix(lmc): handle interrupt signal gracefully
This commit is contained in:
parent
a8cbfb3665
commit
159547e799
2 changed files with 9 additions and 4 deletions
|
|
@ -38,9 +38,6 @@ async function main() {
|
|||
allowPositionals: true,
|
||||
});
|
||||
|
||||
const plainOut = args["plain-out"] ?? args.plain ?? !process.stdout.isTTY;
|
||||
const plainErr = args["plain-err"] ?? args.plain ?? !process.stderr.isTTY;
|
||||
|
||||
if (args.version) {
|
||||
console.log("0.0.0");
|
||||
return;
|
||||
|
|
@ -55,6 +52,8 @@ async function main() {
|
|||
|
||||
const model = args.model ?? config.model;
|
||||
|
||||
const plainOut = args["plain-out"] ?? args.plain ?? !process.stdout.isTTY;
|
||||
const plainErr = args["plain-err"] ?? args.plain ?? !process.stderr.isTTY;
|
||||
const renderer = new Renderer(plainOut, plainErr);
|
||||
|
||||
const provider = createOpenAICompatible({
|
||||
|
|
|
|||
|
|
@ -84,7 +84,13 @@ export default class Renderer {
|
|||
async renderStream(stream: AsyncIterableStream<TextStreamPart<ToolSet>>) {
|
||||
this.resetCounts();
|
||||
|
||||
const spin = spinner({ withGuide: false, indicator: "timer" });
|
||||
const spin = spinner({
|
||||
withGuide: false,
|
||||
indicator: "timer",
|
||||
onCancel: () => {
|
||||
process.exit(130);
|
||||
},
|
||||
});
|
||||
if (!this.isPlain) {
|
||||
spin.start("Waiting for response");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue