Fix #615 by opening the output stream only if needed
authorSoeren Apel <soeren@apelpie.net>
Sat, 15 Aug 2015 21:14:17 +0000 (23:14 +0200)
committerUwe Hermann <uwe@hermann-uwe.de>
Sat, 15 Aug 2015 21:58:23 +0000 (23:58 +0200)
pv/storesession.cpp

index aa2902375e02bd84e479d382b20e1ab32e4e3951..9a30c24379b37a691af0750640997211ee725603 100644 (file)
@@ -55,6 +55,7 @@ using Glib::VariantBase;
 using sigrok::ConfigKey;
 using sigrok::Error;
 using sigrok::OutputFormat;
+using sigrok::OutputFlag;
 
 namespace pv {
 
@@ -140,8 +141,9 @@ bool StoreSession::start()
 
                map<string, Glib::VariantBase> options = options_;
 
-               output_stream_.open(file_name_, ios_base::binary |
-                       ios_base::trunc | ios_base::out);
+               if (!output_format_->test_flag(OutputFlag::INTERNAL_IO_HANDLING))
+                       output_stream_.open(file_name_, ios_base::binary |
+                                       ios_base::trunc | ios_base::out);
 
                output_ = output_format_->create_output(file_name_, device, options);
                auto meta = context->create_meta_packet(