- Timestamp:
- 2010-05-27T23:56:02+12:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/runtime-src/src/recpt/os_process_windows.cpp
r22183 r22188 37 37 #endif 38 38 39 #include "text_t.h" 39 40 #include "os_process_windows.h" 40 41 41 //#include <stdio.h>42 43 osprocesswindows::osprocesswindows(char* cmdline)44 : osprocess(cmdline)45 {}46 42 47 43 osprocesswindows::osprocesswindows(OSProcessPipeMode mode, 48 char* prog_name, char* argv[] =NULL,44 char* prog_name, char* argv[], 49 45 char* envp[]) 50 46 : child_stdout_read_(NULL), child_stdin_write_(NULL), … … 91 87 92 88 si.dwFlags |= STARTF_USESTDHANDLES; 93 94 // any error messages in child process to to same place as parent process 89 90 91 // any error messages in the child process goes to same place as parent 95 92 // e.g. in the case of running as a CGI script, the Web server error log 96 93 si.hStdError = GetStdHandle(STD_ERROR_HANDLE); 97 94 98 // Output from the child process comes to the parent process, down the 99 // OUT pipe 100 si.hStdOutput = child_stdout_write; 101 102 // Input to the child process can be sent from the parent process, down the 103 // In pipe 104 si.hStdInput = child_stdin_read; 105 106 text_t cmd_line = ""; 95 if ((mode==uniRead) || (mode==biReadWrite)) { 96 // Output from the child process comes to the parent process, down the 97 // OUT pipe 98 si.hStdOutput = child_stdout_write; 99 } 100 else { 101 // uniWrite 102 // Output from the chlid process goes to the same place as parent 103 si.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE); 104 } 105 106 if ((mode==uniWrite) || (mode==biReadWrite)) { 107 // Input to the child process can be sent from the parent process, down the 108 // In pipe 109 si.hStdInput = child_stdin_read; 110 } 111 else { 112 // uniRead 113 114 // Input to the child process comes from same place as parent ?!? 115 si.hStdInput = GetStdHandle(STD_INPUT_HANDLE); 116 } 117 118 text_t cmd_line = prog_name; 107 119 if (argv != NULL) { 108 int i= 0;120 int i=1; 109 121 while (argv[i] != NULL) { 110 if (i>0) { 111 cmd_line += " "; 112 } 113 cmd_line += "\"" + argv[i] + "\""; 122 cmd_line += " \""; 123 cmd_line += argv[i]; 124 cmd_line += "\""; 114 125 i++; 115 126 } … … 162 173 163 174 164 int osprocesswindows::write(c onst char* buffer, const int buffer_len)175 int osprocesswindows::write(char* buffer, const int buffer_len) 165 176 { 166 177 DWORD actual_write_len; … … 195 206 196 207 197 bool osprocess unix::close_write_pipe(OSProcessWarnStatus warn_status)208 bool osprocesswindows::close_write_pipe(OSProcessWarnStatus warn_status) 198 209 { 199 210 bool write_close_ok = true; 200 211 201 if (child_std out_read_ != NULL) {212 if (child_stdin_write_ != NULL) { 202 213 203 214 write_close_ok = CloseHandle(child_stdin_write_); … … 211 222 } 212 223 } 213 else if (warn ing_status == withWarning) {224 else if (warn_status == withWarning) { 214 225 cerr << "osprocesswindows::close_write_pipe(): Warning - Tried to close already closed pipe" << endl; 215 226 } … … 219 230 220 231 221 bool osprocess unix::close_read_pipe(OSProcessWarnStatus warn_status)232 bool osprocesswindows::close_read_pipe(OSProcessWarnStatus warn_status) 222 233 { 223 234 bool read_close_ok = true;
Note:
See TracChangeset
for help on using the changeset viewer.