aboutsummaryrefslogblamecommitdiffstatshomepage
path: root/include/winapi/process.hpp
blob: 22317caebc71b8e266aa300fc90fefd15c2cfeb9 (plain) (tree)
1
2
3
4
5
6
7
8
9




                                                                 

            

                       
                     






                  







                                
                                              
                                                  









                                                                      
// 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