19#ifndef WIBBLE_SYS_PIPE_H
20#define WIBBLE_SYS_PIPE_H
77 void run(
int _fd, std::string what ) {
165 Buffer::iterator
nl =
172 std::string line(
buffer.begin(),
nl );
194#pragma GCC diagnostic push
195#pragma GCC diagnostic ignored "-Wold-style-cast"
198#pragma GCC diagnostic pop
226 std::string
run( std::string data ) {
243 while ( !out.
eof() ) {
Base class for system exceptions.
Definition exception.h:397
pid_t fork()
For a subprocess to run proc.
void setupRedirects(int *stdinfd=0, int *stdoutfd=0, int *stderrfd=0)
Definition childprocess.cpp:145
Execute external commands, either forked as a ChildProcess or directly using exec().
Definition exec.h:34
pthread mutex wrapper; WARNING: the class allows copying and assignment, but this is not always safe.
Definition mutex.h:48
Execute a shell command using /bin/sh -c.
Definition exec.h:98
Encapsulates a thread.
Definition thread.h:84
void start()
Start the thread.
Definition thread.cpp:70
void sleep(int secs)
Portable version of sleep.
Definition thread.cpp:31
std::string cmd
Definition pipe.h:222
std::string run(std::string data)
Definition pipe.h:226
PipeThrough(const std::string &_cmd)
Definition pipe.h:224
void * main()
Main thread function, executed in the new thread after creation.
Definition pipe.h:39
Writer()
Definition pipe.h:37
wibble::sys::Mutex mutex
Definition pipe.h:35
bool done()
Definition pipe.h:70
void run(int _fd, std::string what)
Definition pipe.h:77
bool running
Definition pipe.h:33
std::string data
Definition pipe.h:32
bool close
Definition pipe.h:31
int fd
Definition pipe.h:30
bool closed
Definition pipe.h:34
void write(std::string what)
Definition pipe.h:111
static bool blocking(int err)
Definition pipe.h:134
Buffer buffer
Definition pipe.h:94
std::string nextLineBlocking()
Definition pipe.h:204
bool _eof
Definition pipe.h:96
void close()
Definition pipe.h:115
bool eof()
Definition pipe.h:130
int readMore()
Definition pipe.h:142
std::string nextLine()
Definition pipe.h:163
int fd
Definition pipe.h:95
bool valid()
Definition pipe.h:122
Writer writer
Definition pipe.h:97
bool active()
Definition pipe.h:126
Pipe()
Definition pipe.h:108
Pipe(int p)
Definition pipe.h:99
void wait()
Definition pipe.h:182
std::string nextChunk()
Definition pipe.h:157
std::deque< char > Buffer
Definition pipe.h:93
#define assert_eq(x, y)
Definition test.h:33
#define assert(x)
Definition test.h:30
#define assert_neq(x, y)
Definition test.h:36