2018-08-22 03:50:48 +03:00
|
|
|
/*
|
2019-06-20 02:58:25 +03:00
|
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
2018-08-22 03:50:48 +03:00
|
|
|
*
|
2019-06-20 02:58:25 +03:00
|
|
|
* This software may be used and distributed according to the terms of the
|
|
|
|
* GNU General Public License version 2.
|
2018-08-22 03:50:48 +03:00
|
|
|
*/
|
2019-10-11 15:26:59 +03:00
|
|
|
|
2018-08-22 03:50:48 +03:00
|
|
|
#pragma once
|
|
|
|
#include <memory>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
namespace facebook {
|
2018-11-26 19:16:38 +03:00
|
|
|
namespace eden {
|
2018-08-22 03:50:48 +03:00
|
|
|
|
|
|
|
class Pipe;
|
|
|
|
|
|
|
|
class Subprocess {
|
|
|
|
public:
|
|
|
|
Subprocess();
|
|
|
|
Subprocess(const std::vector<std::string>& cmd);
|
|
|
|
~Subprocess();
|
|
|
|
|
2019-05-10 02:28:23 +03:00
|
|
|
void createSubprocess(
|
2018-08-22 03:50:48 +03:00
|
|
|
const std::vector<std::string>& cmd,
|
2019-08-01 22:02:21 +03:00
|
|
|
const char* currentDir = nullptr,
|
2018-08-22 03:50:48 +03:00
|
|
|
std::unique_ptr<Pipe> childInPipe = nullptr,
|
|
|
|
std::unique_ptr<Pipe> childOutPipe = nullptr);
|
|
|
|
|
|
|
|
std::unique_ptr<Pipe> childInPipe_;
|
|
|
|
std::unique_ptr<Pipe> childOutPipe_;
|
|
|
|
|
|
|
|
private:
|
|
|
|
const int bufferSize_ = 4096;
|
|
|
|
};
|
|
|
|
|
2018-11-26 19:16:38 +03:00
|
|
|
} // namespace eden
|
2018-08-22 03:50:48 +03:00
|
|
|
} // namespace facebook
|