Skip to content

Performing multiple HDF5 operations "captures" cout,cerr  #401

@brendenroberts

Description

@brendenroberts

Hi guys, on my system performing multiple HDF5 operations somehow "captures" cout and cerr, and they don't seem to point to the right buffers afterward. I tried this with the newest commit and v3.1.9 as well as C++17 and C++20. In all cases running the following example:

#include "itensor/all_basic.h"

int main(int argc, char *argv[]) {
    auto ofHandle0 = itensor::h5_open("test_0.h5",'w');
    close(ofHandle0);

    std::cout << "cout 0" << std::endl;
    std::cerr << "cerr 0" << std::endl;

    auto ofHandle1 = itensor::h5_open("test_1.h5",'w');
    close(ofHandle1);

    std::cout << "cout 1" << std::endl;
    std::cerr << "cerr 1" << std::endl;

    auto ofHandle2 = itensor::h5_open("test_2.h5",'w');
    close(ofHandle2);

    std::cout << "cout 2" << std::endl;
    std::cerr << "cerr 2" << std::endl;

    return 0;
    }

produces only

cout 0
cerr 0
cerr 1

Adding more flushes doesn't make a difference, and other iostreams don't seem to be affected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions