Browse Source

unix/main: Print usage and NLR errors to stderr instead of stdout.

When stdout is redirected it is useful to have errors printed to stderr
instead of being redirected.

mp_stderr_print() can't be used in these two instances since the
MicroPython runtime is not running so we use fprintf(stderr) instead.
pull/5612/head
David Lechner 5 years ago
committed by Damien George
parent
commit
4ab8bee82f
  1. 4
      ports/unix/main.c

4
ports/unix/main.c

@ -391,7 +391,7 @@ STATIC void pre_process_options(int argc, char **argv) {
#endif
} else {
invalid_arg:
printf("Invalid option\n");
fprintf(stderr, "Invalid option\n");
exit(usage(argv));
}
a++;
@ -709,6 +709,6 @@ uint mp_import_stat(const char *path) {
#endif
void nlr_jump_fail(void *val) {
printf("FATAL: uncaught NLR %p\n", val);
fprintf(stderr, "FATAL: uncaught NLR %p\n", val);
exit(1);
}

Loading…
Cancel
Save