cctools
Functions
sh_popen.h File Reference

Non Terminal-Stealing popen implementation. More...

#include <stdio.h>
#include "process.h"

Go to the source code of this file.

Functions

FILE * sh_popen (char *command)
 
Non Terminal-Stealing popen

sh_popen opens a process for execution, providing its output on a stream, just like the standard popen. More...

 
int sh_pclose (FILE *file)
 Conclude a sh_popen stream. More...
 
int sh_system (char *command)
 
Non Terminal-Stealing system call

sh_system opens a process for execution, and returns the exit status of that call, just like the standard system. More...

 

Detailed Description

Non Terminal-Stealing popen implementation.

Function Documentation

FILE* sh_popen ( char *  command)

Non Terminal-Stealing popen

sh_popen opens a process for execution, providing its output on a stream, just like the standard popen.

However, sh_popen does not steal the terminal control away from the user, making ctrl-c slightly more usuable when signal capturing. This happens by sh_popen forking a child process.

Parameters
commandThe command string to execute.
Returns
A pointer to a file stream which must be closed with sh_pclose.
int sh_pclose ( FILE *  file)

Conclude a sh_popen stream.

Parameters
fileA file pointer returned from sh_popen.
Returns
The exit status of the process.
int sh_system ( char *  command)

Non Terminal-Stealing system call

sh_system opens a process for execution, and returns the exit status of that call, just like the standard system.

However, sh_system does not steal the terminal control away from the user, making ctrl-c slightly more usuable when signal capturing. This happens by sh_system forking a child process.

Parameters
commandThe command string to execute.
Returns
The exit status of the command just executed