mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-14 02:08:27 +08:00

Move logic from commitc85524a94a
(Ensure stdin, stdout, and stderr pipes are always open, 2019-05-02, v3.15.0-rc1~171^2) and commit96010cc968
(Ensure stdin, stdout, stderr FILE streams are open on Windows, 2024-01-24, v3.29.0-rc1~65^2) to a dedicated source. Expose it through an `Init` class constructor to make it optionally available during static initialization. Issue: #26924
28 lines
676 B
C++
28 lines
676 B
C++
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
file LICENSE.rst or https://cmake.org/licensing for details. */
|
|
#pragma once
|
|
|
|
#include "cmConfigure.h" // IWYU pragma: keep
|
|
|
|
namespace cm {
|
|
namespace StdIo {
|
|
|
|
/**
|
|
* Initialize process-wide `stdin`, `stdout`, and `stderr` streams.
|
|
* After construction, standard in/out/err descriptors/handles are open,
|
|
* and standard `FILE*` streams from `<cstdio>` are associated with them.
|
|
*/
|
|
class Init
|
|
{
|
|
public:
|
|
Init();
|
|
~Init() = default;
|
|
Init(Init&&) noexcept = default;
|
|
Init(Init const&) = delete;
|
|
Init& operator=(Init&&) noexcept = default;
|
|
Init& operator=(Init const&) = delete;
|
|
};
|
|
|
|
}
|
|
}
|