blob: f9285e6f576b8d9618b1ef7903bd498308a3012f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
// Copyright (c) 2020 Egor Tensin <Egor.Tensin@gmail.com>
// This file is part of the "winapi-common" project.
// For details, see https://github.com/egor-tensin/winapi-common.
// Distributed under the MIT License.
#include <winapi/file.hpp>
#include <winapi/handle.hpp>
#include <winapi/path.hpp>
#include <winapi/stream.hpp>
#include <string>
#include <utility>
namespace winapi {
namespace process {
Stdin::Stdin() : Stream{Handle::std_in()} {}
Stdout::Stdout() : Stream{Handle::std_out()} {}
Stderr::Stderr() : Stream{Handle::std_err()} {}
Stdin::Stdin(const std::string& path) : Stream{File::open_for_reading(path)} {}
Stdin::Stdin(const CanonicalPath& path) : Stream{File::open_for_reading(path)} {}
Stdout::Stdout(const std::string& path) : Stream{File::open_for_writing(path)} {}
Stdout::Stdout(const CanonicalPath& path) : Stream{File::open_for_writing(path)} {}
Stderr::Stderr(const std::string& path) : Stream{File::open_for_writing(path)} {}
Stderr::Stderr(const CanonicalPath& path) : Stream{File::open_for_writing(path)} {}
Stdin::Stdin(Pipe& pipe) : Stream{std::move(pipe.read_end())} {
pipe.write_end().dont_inherit();
}
Stdout::Stdout(Pipe& pipe) : Stream{std::move(pipe.write_end())} {
pipe.read_end().dont_inherit();
}
Stderr::Stderr(Pipe& pipe) : Stream{std::move(pipe.write_end())} {
pipe.read_end().dont_inherit();
}
} // namespace process
} // namespace winapi
|