diff options
author | Florian Dold <florian@dold.me> | 2023-01-03 10:29:54 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2023-01-03 10:29:54 +0100 |
commit | 988e9fefd7ed105455e90d820f1865c0bf095709 (patch) | |
tree | afd49fcf64f4b95684ade26daab6ef901a41ba5d | |
parent | 768581e2b9e1a0ecba783ca9988d28029b299584 (diff) | |
download | quickjs-tart-988e9fefd7ed105455e90d820f1865c0bf095709.tar.gz quickjs-tart-988e9fefd7ed105455e90d820f1865c0bf095709.tar.bz2 quickjs-tart-988e9fefd7ed105455e90d820f1865c0bf095709.zip |
wip
-rw-r--r-- | qtart.c | 12 | ||||
-rw-r--r-- | quickjs/quickjs-libc.c | 4 |
2 files changed, 5 insertions, 11 deletions
@@ -295,7 +295,6 @@ void help(void) "-d --dump dump the memory usage stats\n" " --memory-limit n limit the memory usage to 'n' bytes\n" " --stack-size n limit the stack size to 'n' bytes\n" - " --unhandled-rejection dump unhandled promise rejections\n" "-q --quit just instantiate the interpreter and quit\n"); exit(1); } @@ -319,7 +318,6 @@ int main(int argc, char **argv) int empty_run = 0; int module = -1; int load_std = 0; - int dump_unhandled_promise_rejection = 0; size_t memory_limit = 0; char *include_list[32]; int i, include_count = 0; @@ -398,10 +396,6 @@ int main(int argc, char **argv) load_std = 1; continue; } - if (!strcmp(longopt, "unhandled-rejection")) { - dump_unhandled_promise_rejection = 1; - continue; - } if (opt == 'q' || !strcmp(longopt, "quit")) { empty_run++; continue; @@ -457,10 +451,8 @@ int main(int argc, char **argv) /* loader for ES6 modules */ JS_SetModuleLoaderFunc(rt, NULL, js_module_loader, NULL); - if (dump_unhandled_promise_rejection) { - JS_SetHostPromiseRejectionTracker(rt, js_std_promise_rejection_tracker, - NULL); - } + JS_SetHostPromiseRejectionTracker(rt, js_std_promise_rejection_tracker, + NULL); if (!empty_run) { js_std_add_helpers(ctx, argc - optind, argv + optind); diff --git a/quickjs/quickjs-libc.c b/quickjs/quickjs-libc.c index a6cfaec..1524c78 100644 --- a/quickjs/quickjs-libc.c +++ b/quickjs/quickjs-libc.c @@ -506,10 +506,12 @@ static JSValue js_std_writeFile(JSContext *ctx, JSValueConst this_val, while (bytes_written < data_len) { size_t sret; - sret = fwrite(data_buf + bytes_written, data_len - bytes_written, 1, file); + sret = fwrite(data_buf + bytes_written, 1, data_len - bytes_written, file); if (0 == sret) { break; } + fprintf(stderr, "wrote %llu/%llu bytes\n", (unsigned long long) sret, (unsigned long long) data_len); + fprintf(stderr, "requested %llu bytes\n", (unsigned long long) (data_len - bytes_written)); bytes_written += sret; } |