Streaming of input and output from Linux command.  
 More...
#include <JProcess.hh>
 | 
| void  | execute (const char *path, const char *arg0, const char *arg1=(char *) NULL, const char *arg2=(char *) NULL, const char *arg3=(char *) NULL, const char *arg4=(char *) NULL, const char *arg5=(char *) NULL, const char *arg6=(char *) NULL, const char *arg7=(char *) NULL, const char *arg8=(char *) NULL, const char *arg9=(char *) NULL) | 
|   | Execute command.  More...
  | 
|   | 
Streaming of input and output from Linux command. 
Definition at line 29 of file JProcess.hh.
 
◆ JProcess() [1/4]
  
  
      
        
          | JSYSTEM::JProcess::JProcess  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Default constructor. 
This constructor starts an interactive shell. 
Definition at line 36 of file JProcess.hh.
   44       execute(
"/bin/tcsh", 
"tcsh", 
"-i", 
"-f");
 
JFileOutputStreamBuffer * gIn
 
void execute(const char *path, const char *arg0, const char *arg1=(char *) NULL, const char *arg2=(char *) NULL, const char *arg3=(char *) NULL, const char *arg4=(char *) NULL, const char *arg5=(char *) NULL, const char *arg6=(char *) NULL, const char *arg7=(char *) NULL, const char *arg8=(char *) NULL, const char *arg9=(char *) NULL)
Execute command.
 
JFileInputStreamBuffer * gErr
 
JFileInputStreamBuffer * gOut
 
 
 
 
◆ JProcess() [2/4]
  
  
      
        
          | JSYSTEM::JProcess::JProcess  | 
          ( | 
          const std::string &  | 
          command | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Constructor. 
- Parameters
 - 
  
  
 
Definition at line 53 of file JProcess.hh.
   61       execute(
"/bin/tcsh", 
"tcsh", 
"-f", 
"-c", command.c_str());
 
 
 
 
◆ ~JProcess()
  
  
      
        
          | JSYSTEM::JProcess::~JProcess  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
inline   | 
  
 
Destructor. 
Definition at line 68 of file JProcess.hh.
   76       if (
gIn  != NULL) { 
delete gIn;  }
 
void close(std::istream *pf)
Close file.
 
 
 
 
◆ JProcess() [3/4]
  
  
      
        
          | JSYSTEM::JProcess::JProcess  | 
          ( | 
          const JProcess &  | 
           | ) | 
           | 
         
       
   | 
  
private   | 
  
 
 
◆ JProcess() [4/4]
  
  
      
        
          | JSYSTEM::JProcess::JProcess  | 
          ( | 
          JProcess &&  | 
           | ) | 
           | 
         
       
   | 
  
private   | 
  
 
 
◆ getInputStreamBuffer()
Get pointer to input stream buffer connected to the normal output stream. 
- Parameters
 - 
  
    | size | size of internal buffers  | 
  
   
- Returns
 - pointer input stream buffer 
 
Definition at line 86 of file JProcess.hh.
   89         gOut = 
new JFileInputStreamBuffer(
out, size);
 
 
 
 
◆ getErrorStreamBuffer()
Get pointer to input stream buffer connected to the error output stream. 
- Parameters
 - 
  
    | size | size of internal buffers  | 
  
   
- Returns
 - pointer to input stream buffer 
 
Definition at line 102 of file JProcess.hh.
  105         gErr = 
new JFileInputStreamBuffer(
err, size);
 
 
 
 
◆ getOutputStreamBuffer()
Get pointer to output stream buffer connected to the normal input stream. 
- Parameters
 - 
  
    | size | size of internal buffers  | 
  
   
- Returns
 - pointer to output stream buffer 
 
Definition at line 118 of file JProcess.hh.
  121         gIn = 
new JFileOutputStreamBuffer(
in, size);
 
 
 
 
◆ execute()
  
  
      
        
          | void JSYSTEM::JProcess::execute  | 
          ( | 
          const char *  | 
          path,  | 
         
        
           | 
           | 
          const char *  | 
          arg0,  | 
         
        
           | 
           | 
          const char *  | 
          arg1 = (char*) NULL,  | 
         
        
           | 
           | 
          const char *  | 
          arg2 = (char*) NULL,  | 
         
        
           | 
           | 
          const char *  | 
          arg3 = (char*) NULL,  | 
         
        
           | 
           | 
          const char *  | 
          arg4 = (char*) NULL,  | 
         
        
           | 
           | 
          const char *  | 
          arg5 = (char*) NULL,  | 
         
        
           | 
           | 
          const char *  | 
          arg6 = (char*) NULL,  | 
         
        
           | 
           | 
          const char *  | 
          arg7 = (char*) NULL,  | 
         
        
           | 
           | 
          const char *  | 
          arg8 = (char*) NULL,  | 
         
        
           | 
           | 
          const char *  | 
          arg9 = (char*) NULL  | 
         
        
           | 
          ) | 
           |  | 
         
       
   | 
  
inlineprotected   | 
  
 
Execute command. 
- Parameters
 - 
  
    | path | path  | 
    | arg0 | comma separted argument list  | 
    | arg1 | comma separted argument list  | 
    | arg2 | comma separted argument list  | 
    | arg3 | comma separted argument list  | 
    | arg4 | comma separted argument list  | 
    | arg5 | comma separted argument list  | 
    | arg6 | comma separted argument list  | 
    | arg7 | comma separted argument list  | 
    | arg8 | comma separted argument list  | 
    | arg9 | comma separted argument list  | 
  
   
Definition at line 143 of file JProcess.hh.
  159       if (pipe(pipe_stdin))  { 
THROW(JPipeOpenException, 
"Error at pipe of standard input.");  }
 
  160       if (pipe(pipe_stdout)) { 
THROW(JPipeOpenException, 
"Error at pipe of standard output."); }
 
  161       if (pipe(pipe_stderr)) { 
THROW(JPipeOpenException, 
"Error at pipe of standard error.");  }
 
  163       const pid_t pid = fork();
 
  169         THROW(JForkException, 
"JProcess::fork() failed");
 
  175         close(pipe_stdin [1]);
 
  176         if (dup2 (pipe_stdin [0], STDIN_FILENO)  == -1) { JSystemException(
"dup2-stdin"); }
 
  178         close(pipe_stdout[0]);
 
  179         if (dup2 (pipe_stdout[1], STDOUT_FILENO) == -1) { JSystemException(
"dup2-stdout"); }
 
  181         close(pipe_stdout[0]);
 
  182         if (dup2 (pipe_stdout[1], STDERR_FILENO) == -1) { JSystemException(
"dup2-stderr"); }
 
  184         execl(path, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, (
char*) NULL);
 
  186         THROW(JSystemException, path);
 
  193         out = pipe_stdout[0];
 
  194         err = pipe_stderr[0];
 
  196         close(pipe_stdin [0]);
 
  197         close(pipe_stdout[1]);
 
  198         close(pipe_stderr[1]);
 
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
 
 
 
 
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ out
  
  
      
        
          | int JSYSTEM::JProcess::out | 
         
       
   | 
  
protected   | 
  
 
 
◆ err
  
  
      
        
          | int JSYSTEM::JProcess::err | 
         
       
   | 
  
protected   | 
  
 
 
◆ in
  
  
      
        
          | int JSYSTEM::JProcess::in | 
         
       
   | 
  
protected   | 
  
 
 
◆ gOut
◆ gErr
◆ gIn
The documentation for this class was generated from the following file: