Merge branch 'main' into tool-search
This commit is contained in:
commit
4a7ae16ffd
2 changed files with 9 additions and 1 deletions
|
|
@ -19,6 +19,7 @@ import {
|
||||||
} from "./client/index.js";
|
} from "./client/index.js";
|
||||||
import { handleError } from "./error-handler.js";
|
import { handleError } from "./error-handler.js";
|
||||||
import { createTransport, TransportOptions } from "./transport.js";
|
import { createTransport, TransportOptions } from "./transport.js";
|
||||||
|
import { awaitableLog } from "./utils/awaitable-log.js";
|
||||||
|
|
||||||
// JSON value type for CLI arguments
|
// JSON value type for CLI arguments
|
||||||
type JsonValue =
|
type JsonValue =
|
||||||
|
|
@ -167,7 +168,7 @@ async function callMethod(args: Args): Promise<void> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(JSON.stringify(result, null, 2));
|
await awaitableLog(JSON.stringify(result, null, 2));
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
await disconnect(transport);
|
await disconnect(transport);
|
||||||
|
|
|
||||||
7
cli/src/utils/awaitable-log.ts
Normal file
7
cli/src/utils/awaitable-log.ts
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
export function awaitableLog(logValue: string): Promise<void> {
|
||||||
|
return new Promise<void>((resolve) => {
|
||||||
|
process.stdout.write(logValue, () => {
|
||||||
|
resolve();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue