mirror of
https://github.com/NixOS/nix
synced 2025-07-06 17:31:47 +02:00
Clean up standard stream logic
Now we have enough portability stuff
This commit is contained in:
parent
0ed5af164f
commit
372353722e
9 changed files with 44 additions and 18 deletions
|
@ -106,8 +106,25 @@ void drainFD(
|
|||
#endif
|
||||
);
|
||||
|
||||
/**
|
||||
* Get [Standard Input](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin))
|
||||
*/
|
||||
[[gnu::always_inline]]
|
||||
inline Descriptor getStandardOut() {
|
||||
inline Descriptor getStandardInput()
|
||||
{
|
||||
#ifndef _WIN32
|
||||
return STDIN_FILENO;
|
||||
#else
|
||||
return GetStdHandle(STD_INPUT_HANDLE);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Get [Standard Output](https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout))
|
||||
*/
|
||||
[[gnu::always_inline]]
|
||||
inline Descriptor getStandardOutput()
|
||||
{
|
||||
#ifndef _WIN32
|
||||
return STDOUT_FILENO;
|
||||
#else
|
||||
|
@ -115,6 +132,19 @@ inline Descriptor getStandardOut() {
|
|||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Get [Standard Error](https://en.wikipedia.org/wiki/Standard_streams#Standard_error_(stderr))
|
||||
*/
|
||||
[[gnu::always_inline]]
|
||||
inline Descriptor getStandardError()
|
||||
{
|
||||
#ifndef _WIN32
|
||||
return STDERR_FILENO;
|
||||
#else
|
||||
return GetStdHandle(STD_ERROR_HANDLE);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Automatic cleanup of resources.
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue