21class TerminalProcess_Posix :
public ITerminalProcess
24 TerminalProcess_Posix();
25 ~TerminalProcess_Posix()
override;
27 bool Start(
const TerminalLaunchConfig& cfg, std::string& outError)
override;
28 bool WriteStdin(
const char* data,
size_t len)
override;
29 void RequestStop()
override;
30 void ForceKill()
override;
31 bool IsRunning()
const override {
return mRunning.load(); }
32 int GetExitCode()
const override {
return mExitCode.load(); }
34 bool IsTty()
const override {
return false; }
37 void ReaderLoop(
int fd, TerminalEntryKind kind);
44 int mStdoutPipe[2] = { -1, -1 };
45 int mStderrPipe[2] = { -1, -1 };
46 int mStdinPipe[2] = { -1, -1 };
48 std::thread mStdoutReader;
49 std::thread mStderrReader;
50 std::thread mWaitThread;
52 std::atomic<bool> mRunning{
false };
53 std::atomic<bool> mStopRequested{
false };
54 std::atomic<int> mExitCode{ 0 };
56 std::mutex mStdinMutex;
57 std::mutex mLifecycleMutex;