I am building a "Transform & Replace Selection with JavaScript" action. I have been trying to capture the output of a shell script that does IO. The script in question is a pretty widespread Python CLI interface to remote and local LLMs (GitHub - simonw/llm: Access large language models from the command-line).
async (content) => {
let cmd = `/path/to/llm "${content}"`;
let resp = await runShellScript({script: cmd});
return(resp);
}
But the output doesn't get captured. Probably because of IO delay. Indeed, the following does work:
async (content) => {
let cmd = `echo "${content}"`;
let resp = await runShellScript({script: cmd});
return(resp);
}
When I run llm --help
as the command, the help message get captured (no IO involved) too. But when I run a query, as shown above, no output get captured. (Needless to say, it works fine in the terminal).
Any idea? (Is there a way to specify a timeout, for instance?)