1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 02:08:27 +08:00
Files
CMake/Source/cmStdIoInit.h
Brad King cef4676d3a StdIo: Factor out helper to initialize stdin, stdout, and stderr
Move logic from commit c85524a94a (Ensure stdin, stdout, and stderr pipes
are always open, 2019-05-02, v3.15.0-rc1~171^2) and commit 96010cc968
(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
2025-05-08 13:39:48 -04:00

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;
};
}
}