diff options
author | JF Bastien <github@jfbastien.com> | 2016-01-08 11:28:24 -0800 |
---|---|---|
committer | JF Bastien <github@jfbastien.com> | 2016-01-08 11:28:24 -0800 |
commit | b2760f93e66c628f58d92484bb2885713bb9877c (patch) | |
tree | 57556593c67bb155e7d9296033ea9fec6633b0f3 | |
parent | ae2a84670ff06f2d06df01a0e384f6944f1ad939 (diff) | |
download | binaryen-b2760f93e66c628f58d92484bb2885713bb9877c.tar.gz binaryen-b2760f93e66c628f58d92484bb2885713bb9877c.tar.bz2 binaryen-b2760f93e66c628f58d92484bb2885713bb9877c.zip |
s2wasm: only create output file when successful
Previously the file was created but was empty when s2wasm failed. This caused sexpr-wasm to be sad because it tried to use an empty file.
-rw-r--r-- | src/s2wasm-main.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/s2wasm-main.cpp b/src/s2wasm-main.cpp index 278fec693..277cee365 100644 --- a/src/s2wasm-main.cpp +++ b/src/s2wasm-main.cpp @@ -46,7 +46,6 @@ int main(int argc, const char *argv[]) { options.parse(argc, argv); std::string input(read_file(options.extra["infile"], options.debug)); - Output output(options.extra["output"], options.debug); if (options.debug) std::cerr << "Parsing and wasming..." << std::endl; AllocatingModule wasm; @@ -61,6 +60,7 @@ int main(int argc, const char *argv[]) { s2wasm.emscriptenGlue(meta); if (options.debug) std::cerr << "Printing..." << std::endl; + Output output(options.extra["output"], options.debug); output << wasm << meta.str() << std::endl; if (options.debug) std::cerr << "Done." << std::endl; |