From fffeac664f2e4433602ad3f34f649b078ba9e782 Mon Sep 17 00:00:00 2001 From: Thomas Lively <7121787+tlively@users.noreply.github.com> Date: Mon, 30 Aug 2021 09:42:45 -0700 Subject: Use ModuleReader::readStdin for file "-" (#4114) After #4106 we already treat the input file "-" as a shorthand for reading from stdin at the file.cpp level. However, the "-" input was still treated as a normal file name at the wasm-io.cpp file and as a result was always treated as text input. This commit updates wasm-io.cpp to use the stdin code path supporting both binary and text input for "-". Fixes #4105 (again). --- src/wasm/wasm-io.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/wasm/wasm-io.cpp') diff --git a/src/wasm/wasm-io.cpp b/src/wasm/wasm-io.cpp index b8d67f4d5..b94fc8470 100644 --- a/src/wasm/wasm-io.cpp +++ b/src/wasm/wasm-io.cpp @@ -88,8 +88,8 @@ bool ModuleReader::isBinaryFile(std::string filename) { void ModuleReader::read(std::string filename, Module& wasm, std::string sourceMapFilename) { - // empty filename means read from stdin - if (!filename.size()) { + // empty filename or "-" means read from stdin + if (!filename.size() || filename == "-") { readStdin(wasm, sourceMapFilename); return; } -- cgit v1.2.3