GH #2689: Added tryWait() into Process and ProcessHandle. Handle kill()-ed UNIX process exit codes.

This commit is contained in:
Günter Obiltschnig
2020-01-22 08:23:36 +01:00
parent 5f0e0a0374
commit 924cdf235c
12 changed files with 187 additions and 95 deletions

View File

@@ -36,10 +36,11 @@ class Foundation_API ProcessHandleImpl: public RefCountedObject
public:
ProcessHandleImpl(pid_t pid);
~ProcessHandleImpl();
pid_t id() const;
int wait() const;
int tryWait() const;
private:
pid_t _pid;
};
@@ -51,15 +52,15 @@ public:
typedef pid_t PIDImpl;
typedef std::vector<std::string> ArgsImpl;
typedef std::map<std::string, std::string> EnvImpl;
static PIDImpl idImpl();
static void timesImpl(long& userTime, long& kernelTime);
static ProcessHandleImpl* launchImpl(
const std::string& command,
const ArgsImpl& args,
const std::string& command,
const ArgsImpl& args,
const std::string& initialDirectory,
Pipe* inPipe,
Pipe* outPipe,
Pipe* inPipe,
Pipe* outPipe,
Pipe* errPipe,
const EnvImpl& env);
static void killImpl(ProcessHandleImpl& handle);
@@ -70,11 +71,11 @@ public:
private:
static ProcessHandleImpl* launchByForkExecImpl(
const std::string& command,
const ArgsImpl& args,
const std::string& command,
const ArgsImpl& args,
const std::string& initialDirectory,
Pipe* inPipe,
Pipe* outPipe,
Pipe* inPipe,
Pipe* outPipe,
Pipe* errPipe,
const EnvImpl& env);
};