source: filezilla/trunk/fuentes/src/engine/fzprocess.h @ 130

Last change on this file since 130 was 130, checked in by jrpelegrina, 3 years ago

First release to xenial

File size: 787 bytes
Line 
1#ifndef FILEZILLA_ENGINE_PROCESS_HEADER
2#define FILEZILLA_ENGINE_PROCESS_HEADER
3
4/*
5The CProcess class manages an asynchronous process with redirected IO.
6No console window is being created.
7
8To use, spawn the process and call read from a different thread.
9*/
10
11#include <memory>
12#include <vector>
13
14class CProcess final
15{
16public:
17        CProcess();
18        ~CProcess();
19
20        CProcess(CProcess const&) = delete;
21        CProcess& operator=(CProcess const&) = delete;
22
23        bool Execute(wxString const& cmd, std::vector<wxString> const& args);
24
25        void Kill();
26
27        // Blocking function. Returns Number of bytes read, 0 on EOF, -1 on error.
28        int Read(char* buffer, unsigned int len);
29
30        // Blocking function
31        bool Write(char const* buffer, unsigned int len);
32
33private:
34        class Impl;
35        std::unique_ptr<Impl> impl_;
36};
37
38#endif
Note: See TracBrowser for help on using the repository browser.