58 lines
1.3 KiB
C++
58 lines
1.3 KiB
C++
/***
|
|
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
File: Process.Unix.hpp
|
|
File: Process.Linux.hpp
|
|
Date: 2021-6-12
|
|
Author: Reece
|
|
***/
|
|
|
|
namespace Aurora::Processes
|
|
{
|
|
void DeinitUnix();
|
|
void InitUnix();
|
|
|
|
class ProcessImpl : public IProcess
|
|
{
|
|
public:
|
|
ProcessImpl(const StartupParmaters ¶ms);
|
|
~ProcessImpl();
|
|
|
|
void ShutdownPipes();
|
|
|
|
bool TryKill() override;
|
|
bool Terminate() override;
|
|
AuSPtr<Aurora::Threading::IWaitable> AsWaitable() override;
|
|
|
|
AuSInt GetExitCode() override;
|
|
|
|
AuUInt GetProcessId() override;
|
|
|
|
bool Read(EStandardHandle stream, const AuMemoryViewStreamWrite &destination, bool nonblock) override;
|
|
bool Write(const AuMemoryViewStreamRead &source) override;
|
|
|
|
bool Start() override;
|
|
|
|
bool Init();
|
|
|
|
void ByeLol(AuSInt code);
|
|
private:
|
|
|
|
int pipeStdOut_[2]{};
|
|
int pipeStdErr_[2]{};
|
|
int pipeStdIn_ [2]{};
|
|
|
|
AuThreadPrimitives::EventShared_t finished_;
|
|
|
|
StartupParmaters startup_;
|
|
ESpawnType type_;
|
|
|
|
AuList<const char *> cargs_;
|
|
AuString debug_;
|
|
|
|
pid_t pidt_;
|
|
bool alive_ {};
|
|
|
|
AuSInt exitCode_;
|
|
};
|
|
} |