1 #ifndef __JSYSTEM__JPROCESS__
2 #define __JSYSTEM__JPROCESS__
15 namespace JPP {
using namespace JSYSTEM; }
44 execute(
"/bin/tcsh",
"tcsh",
"-i",
"-f");
61 execute(
"/bin/tcsh",
"tcsh",
"-f",
"-c", command.c_str());
76 if (
gIn != NULL) {
delete gIn; }
145 const char* arg1 = (
char*) NULL,
146 const char* arg2 = (
char*) NULL,
147 const char* arg3 = (
char*) NULL,
148 const char* arg4 = (
char*) NULL,
149 const char* arg5 = (
char*) NULL,
150 const char* arg6 = (
char*) NULL,
151 const char* arg7 = (
char*) NULL,
152 const char* arg8 = (
char*) NULL,
153 const char* arg9 = (
char*) NULL)
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();
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);
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]);
JFileInputStreamBuffer * getErrorStreamBuffer(const std::size_t size=65536)
Get pointer to input stream buffer connected to the error output stream.
JProcess(const std::string &command)
Constructor.
$WORKDIR driver txt done cat $WORKDIR driver txt<< EOFprocess ${DATAFILTER}$FILTER_HOST csh-c '(setenv ROOTSYS $ROOTSYS &&source $JPP_DIR/setenv.csh $JPP_DIR &&JDataFilter-H\$SERVER\$-M\$LOGGER\$-d $DEBUG-u ${DATAFILTER}-P $PORT</dev/null > &/dev/null)&';process ${DATAWRITER}$WRITER_HOST csh-c '(setenv ROOTSYS $ROOTSYS &&source $JPP_DIR/setenv.csh $JPP_DIR &&JDataWriter-H\$SERVER\$-M\$LOGGER\$-d $DEBUG-u ${DATAWRITER}</dev/null > &/dev/null)&';print enterevent ev_init{RC_CMD}event ev_reset{RC_CMD}event ev_init{RC_CMD}event ev_configure{RC_DFLTR%<$WORKDIR/ev_configure_datafilter.txt > RC_DOM<$WORKDIR/ev_configure_domsimulator.txt > RC_DWRT path
Exception for opening of pipe.
void close(std::istream *pf)
Close file.
Exception for creation of fork.
Output file stream buffer.
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.
JFileOutputStreamBuffer * getOutputStreamBuffer(const std::size_t size=65536)
Get pointer to output stream buffer connected to the normal input stream.
Streaming of input and output from Linux command.
JFileInputStreamBuffer * getInputStreamBuffer(const std::size_t size=65536)
Get pointer to input stream buffer connected to the normal output stream.
JFileOutputStreamBuffer * gIn
JFileInputStreamBuffer * gOut
Exception for system call.
JProcess()
Default constructor.
JFileInputStreamBuffer * gErr