File: EShellProcess.h

package info (click to toggle)
miwm 1.1-6
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 1,296 kB
  • ctags: 910
  • sloc: cpp: 8,179; sh: 231; makefile: 148
file content (53 lines) | stat: -rw-r--r-- 1,640 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// EShellProcess.h
#ifndef ESHELLPROCESS_H_INCLUDED
#define ESHELLPROCESS_H_INCLUDED
#include <string>
#include <iostream>

using std::string;
/**
   License: See LICENSE file in this directory.
   Author: stephan@wanderinghorse.net
*/
class EShellProcess 
{
public:
        /**
           For running shell processes. Note that the
           functions DO NOT follow the conventions set forth
           by EArgsProcessor: they do not treat argument 0
           specially.
        */
        EShellProcess(){};
        ~EShellProcess() {};

        /**
           Runs the given command line using popen() and
           returns 0 on success, or non-zero on failure.  All
           output generated by the process (to stdout or
           stderr) will be sent, character by character, to
           the given outstream.
        */
        int pipe( const std::string &, std::ostream & os );
        /**
           calls fork()/exec().
           Largely untested.

           A serious limitation: input string may have no more
           than some arbitrary number of tokens (as counted by
           EStdStringTokenizer::tokenize()).
        */
        int fork( const std::string &, std::ostream & os );
        /**
           calls ::system(). Note that os is ignored, but
           provided for API compatibility. It may be used in
           some way in the future.
        */
        int system( const std::string &, std::ostream & os = std::cout );

private:
        EShellProcess( const EShellProcess & );
        EShellProcess & operator=( const EShellProcess & );
        void init(){};
};
#endif // ESHELLPROCESS_H_INCLUDED