add option to capture stdout

This commit is contained in:
ading2210 2024-02-02 23:11:59 +00:00
parent bb9d9239c0
commit 3c517bbaf5
11 changed files with 64 additions and 20 deletions

View file

@ -0,0 +1,11 @@
async function test() {
let output = [];
function out_callback(text) {
output.push(text);
}
libcurl.stdout = out_callback;
libcurl.stderr = out_callback;
await libcurl.fetch("https://example.com/", {_libcurl_verbose: 1});
console.log(output);
assert(output[0] === "* Host example.com:443 was resolved.", "unexpected output in stderr");
}