File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ import {
19
19
} from "./client/index.js" ;
20
20
import { handleError } from "./error-handler.js" ;
21
21
import { createTransport , TransportOptions } from "./transport.js" ;
22
+ import { awaitableLog } from "./utils/awaitable-log.js" ;
22
23
23
24
// JSON value type for CLI arguments
24
25
type JsonValue =
@@ -167,7 +168,7 @@ async function callMethod(args: Args): Promise<void> {
167
168
) ;
168
169
}
169
170
170
- console . log ( JSON . stringify ( result , null , 2 ) ) ;
171
+ await awaitableLog ( JSON . stringify ( result , null , 2 ) ) ;
171
172
} finally {
172
173
try {
173
174
await disconnect ( transport ) ;
Original file line number Diff line number Diff line change
1
+ export function awaitableLog ( logValue : string ) : Promise < void > {
2
+ return new Promise < void > ( ( resolve ) => {
3
+ process . stdout . write ( logValue , ( ) => {
4
+ resolve ( ) ;
5
+ } ) ;
6
+ } ) ;
7
+ }
You can’t perform that action at this time.
0 commit comments