aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/winapi/process.hpp
blob: 22317caebc71b8e266aa300fc90fefd15c2cfeb9 (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
// 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.

#pragma once

#include "cmd_line.hpp"
#include "handle.hpp"
#include "stream.hpp"

#include <utility>

namespace winapi {

class Process {
public:
    struct IO {
        process::Stdin std_in;
        process::Stdout std_out;
        process::Stderr std_err;

        void close();
    };

    static Process create(const CommandLine&);
    static Process create(const CommandLine&, IO);

    void wait();

private:
    explicit Process(Handle&& handle) : m_handle{std::move(handle)} {}

    Handle m_handle;
};

} // namespace winapi