|
libassa 3.5.1
|
#include <Pipe.h>
Public Member Functions | |
| Pipe () | |
| A no-op constructor. | |
| ~Pipe () | |
| Destructor calls close () first in an attempt to close opened pipe. | |
| FILE * | open (const string &cmd_, const string &type_) |
| Starts a subshell and feed it the string cmd_ to be executed. | |
| int | close () |
| Close the pipe. | |
| int | kill () |
| Kill subprocess with SIGTERM. | |
| pid_t | pid () const |
| Get subprocess' PID. | |
| FILE * | fp () const |
| Get pipe's standard I/O file pointer. | |
| int | fd () const |
| Get pipe's file descriptor. | |
Private Member Functions | |
| Pipe (const Pipe &) | |
| Pipe & | operator= (const Pipe &) |
Private Attributes | |
| FILE * | m_fp |
| A standard I/O stream descriptor. | |
| pid_t | m_child_pid |
| Supbrocess' PID. | |
| Pipe::Pipe | ( | ) |
A no-op constructor.
Definition at line 33 of file Pipe.cpp.
References ASSA::PIPE, and trace_with_mask.
| Pipe::~Pipe | ( | ) |
Destructor calls close () first in an attempt to close opened pipe.
Definition at line 42 of file Pipe.cpp.
References close(), ASSA::PIPE, and trace_with_mask.
| int Pipe::close | ( | ) |
Close the pipe.
The subprocess' status is collected to ensure that the child process have finished.
Definition at line 135 of file Pipe.cpp.
References m_child_pid, m_fp, ASSA::PIPE, and trace_with_mask.
|
inline |
|
inline |
| int Pipe::kill | ( | ) |
Kill subprocess with SIGTERM.
You should most probably call close() afterwards to collect child process' status.
Definition at line 117 of file Pipe.cpp.
References ASSA::ASSAERR, close(), DL, kill(), m_child_pid, ASSA::PIPE, and trace_with_mask.
Referenced by kill().
Starts a subshell and feed it the string cmd_ to be executed.
The pipe is created and attached to the standard input or standard output of the subprocess, according to whether type_ is either "r" (read) or "w" (write). The other end of the pipe is returned to the calling code as a standard I/O stream, FILE, ready for buffered use with fprintf(), fscanf(), fgets, etc.
| cmd_ | command to execute |
| type_ | "w" for write pipe and "r" for read pipe |
Definition at line 50 of file Pipe.cpp.
References ASSA::ASSAERR, close(), DL, EL, fd(), ASSA::Fork::IGNORE_STATUS, ASSA::Fork::KILL_ON_EXIT, m_child_pid, m_fp, ASSA::PIPE, and trace_with_mask.
|
inline |
|
private |
|
private |