diff options
author | David Lechner <david@pybricks.com> | 2020-01-29 11:23:59 -0600 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2020-02-01 22:44:08 +1100 |
commit | 4ab8bee82f7d095c10c624de93da12a7aa1af8fd (patch) | |
tree | 0289f1aae9df626cab29aa71a64ccee88d30b381 | |
parent | 61f64c78a6c3ebfe42292b0ff9c93442883f5f0d (diff) | |
download | micropython-4ab8bee82f7d095c10c624de93da12a7aa1af8fd.tar.gz micropython-4ab8bee82f7d095c10c624de93da12a7aa1af8fd.zip |
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.
-rw-r--r-- | ports/unix/main.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ports/unix/main.c b/ports/unix/main.c index fcf8b1558c..e129154544 100644 --- a/ports/unix/main.c +++ b/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); } |