diff --git a/mpy-cross/main.c b/mpy-cross/main.c index 20f3f85db..87e44e379 100644 --- a/mpy-cross/main.c +++ b/mpy-cross/main.c @@ -90,7 +90,8 @@ STATIC int compile_and_save(const char *file, const char *output_file, const cha cm.context = m_new_obj(mp_module_context_t); mp_compile_to_raw_code(&parse_tree, source_name, false, &cm); - if (output_file != NULL && strcmp(output_file, "-") == 0) { + if ((output_file != NULL && strcmp(output_file, "-") == 0) || + (output_file == NULL && strcmp(file, "-") == 0)) { mp_raw_code_save(&cm, (mp_print_t *)&mp_stdout_print); } else { vstr_t vstr; @@ -121,7 +122,7 @@ STATIC int usage(char **argv) { "usage: %s [] [-X ] [--] \n" "Options:\n" "--version : show version information\n" - "-o : output file for compiled bytecode (defaults to input with .mpy extension)\n" + "-o : output file for compiled bytecode (defaults to input filename with .mpy extension, or stdout if input is stdin)\n" "-s : source filename to embed in the compiled bytecode (defaults to input file)\n" "-v : verbose (trace various operations); can be multiple\n" "-O[N] : apply bytecode optimizations of level N\n"