2018-08-22 03:50:48 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018-present, Facebook, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the BSD-style license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#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,
|
|
|
|
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
|