2018-12-31 20:04:05 +01:00
|
|
|
//
|
2018-01-02 14:42:31 +01:00
|
|
|
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2018
|
2018-12-31 20:04:05 +01:00
|
|
|
//
|
|
|
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
|
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
//
|
2018-08-13 19:15:09 +02:00
|
|
|
#if 0
|
2018-12-31 20:04:05 +01:00
|
|
|
|
|
|
|
namespace td {
|
|
|
|
|
|
|
|
#if TD_PORT_WINDOWS
|
|
|
|
|
|
|
|
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM)
|
|
|
|
Fd &Fd::Stderr() {
|
|
|
|
static auto handle = GetStdHandle(STD_ERROR_HANDLE);
|
|
|
|
LOG_IF(FATAL, handle == INVALID_HANDLE_VALUE) << "Failed to get stderr";
|
|
|
|
static auto fd = Fd(Fd::Type::FileFd, Fd::Mode::Reference, handle);
|
|
|
|
return fd;
|
|
|
|
}
|
|
|
|
Fd &Fd::Stdin() {
|
|
|
|
static auto handle = GetStdHandle(STD_INPUT_HANDLE);
|
|
|
|
LOG_IF(FATAL, handle == INVALID_HANDLE_VALUE) << "Failed to get stdin";
|
|
|
|
static auto fd = Fd(Fd::Type::FileFd, Fd::Mode::Reference, handle);
|
|
|
|
return fd;
|
|
|
|
}
|
|
|
|
Fd &Fd::Stdout() {
|
|
|
|
static auto handle = GetStdHandle(STD_OUTPUT_HANDLE);
|
|
|
|
LOG_IF(FATAL, handle == INVALID_HANDLE_VALUE) << "Failed to get stdout";
|
|
|
|
static auto fd = Fd(Fd::Type::FileFd, Fd::Mode::Reference, handle);
|
|
|
|
return fd;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
Fd &Fd::Stderr() {
|
|
|
|
static Fd result;
|
|
|
|
result = Fd();
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
Fd &Fd::Stdin() {
|
|
|
|
static Fd result;
|
|
|
|
result = Fd();
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
Fd &Fd::Stdout() {
|
|
|
|
static Fd result;
|
|
|
|
result = Fd();
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
} // namespace td
|
2018-08-13 19:15:09 +02:00
|
|
|
#endif
|