Ninja
Public Member Functions | Private Member Functions | Private Attributes | Friends
Subprocess Struct Reference

Subprocess wraps a single async subprocess. More...

#include <subprocess.h>

List of all members.

Public Member Functions

bool Done () const
ExitStatus Finish ()
 Returns ExitSuccess on successful process exit, ExitInterrupted if the process was interrupted, ExitFailure if it otherwise failed.
const string & GetOutput () const
 ~Subprocess ()

Private Member Functions

void OnPipeReady ()
bool Start (struct SubprocessSet *set, const string &command)
 Subprocess ()

Private Attributes

string buf_
int fd_
pid_t pid_

Friends

struct SubprocessSet

Detailed Description

Subprocess wraps a single async subprocess.

It is entirely passive: it expects the caller to notify it when its fds are ready for reading, as well as call Finish() to reap the child once done() is true.

Definition at line 35 of file subprocess.h.


Constructor & Destructor Documentation

Definition at line 30 of file subprocess-posix.cc.

References fd_, Finish(), and pid_.

Subprocess::Subprocess ( ) [private]

Definition at line 28 of file subprocess-posix.cc.


Member Function Documentation

bool Subprocess::Done ( ) const

Definition at line 133 of file subprocess-posix.cc.

References fd_.

Referenced by TEST_F().

Returns ExitSuccess on successful process exit, ExitInterrupted if the process was interrupted, ExitFailure if it otherwise failed.

Definition at line 115 of file subprocess-posix.cc.

References ExitFailure, ExitInterrupted, ExitSuccess, Fatal(), and pid_.

Referenced by TEST_F(), RealCommandRunner::WaitForCommand(), and ~Subprocess().

const string & Subprocess::GetOutput ( ) const

Definition at line 137 of file subprocess-posix.cc.

References buf_.

Referenced by TEST_F(), and RealCommandRunner::WaitForCommand().

void Subprocess::OnPipeReady ( ) [private]

Definition at line 102 of file subprocess-posix.cc.

References buf_, Fatal(), and fd_.

bool Subprocess::Start ( struct SubprocessSet set,
const string &  command 
) [private]

Definition at line 38 of file subprocess-posix.cc.

References Fatal(), fd_, pid_, and SetCloseOnExec().

Referenced by SubprocessSet::Add().


Friends And Related Function Documentation

friend struct SubprocessSet [friend]

Definition at line 68 of file subprocess.h.


Member Data Documentation

string Subprocess::buf_ [private]

Definition at line 51 of file subprocess.h.

Referenced by GetOutput(), and OnPipeReady().

int Subprocess::fd_ [private]

Definition at line 64 of file subprocess.h.

Referenced by Done(), OnPipeReady(), Start(), and ~Subprocess().

pid_t Subprocess::pid_ [private]

Definition at line 65 of file subprocess.h.

Referenced by Finish(), Start(), and ~Subprocess().


The documentation for this struct was generated from the following files: