[22173] | 1 | /**********************************************************************
|
---|
| 2 | *
|
---|
| 3 | * os_process_unix.h -- Unix version of osprocess. See os_process.h
|
---|
| 4 | * for more details
|
---|
| 5 | *
|
---|
| 6 | * Copyright (C) 2010 The New Zealand Digital Library Project
|
---|
| 7 | *
|
---|
| 8 | * A component of the Greenstone digital library software
|
---|
| 9 | * from the New Zealand Digital Library Project at the
|
---|
| 10 | * University of Waikato, New Zealand.
|
---|
| 11 | *
|
---|
| 12 | * This program is free software; you can redistribute it and/or modify
|
---|
| 13 | * it under the terms of the GNU General Public License as published by
|
---|
| 14 | * the Free Software Foundation; either version 2 of the License, or
|
---|
| 15 | * (at your option) any later version.
|
---|
| 16 | *
|
---|
| 17 | * This program is distributed in the hope that it will be useful,
|
---|
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 20 | * GNU General Public License for more details.
|
---|
| 21 | *
|
---|
| 22 | * You should have received a copy of the GNU General Public License
|
---|
| 23 | * along with this program; if not, write to the Free Software
|
---|
| 24 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
| 25 | *
|
---|
| 26 | *********************************************************************/
|
---|
| 27 |
|
---|
| 28 |
|
---|
| 29 | #ifndef OS_PROCESS_UNIX_H
|
---|
| 30 | #define OS_PROCESS_UNIX_H
|
---|
| 31 |
|
---|
| 32 | #ifndef __WIN32__ // i.e. Unix
|
---|
| 33 |
|
---|
| 34 | #include "os_process.h"
|
---|
| 35 |
|
---|
| 36 | class osprocessunix : osprocess
|
---|
| 37 | {
|
---|
| 38 |
|
---|
| 39 | public:
|
---|
[22174] | 40 | osprocessunix(char* cmd, OSProcessPipeMode mode);
|
---|
| 41 | virtual ~osprocessunix();
|
---|
[22173] | 42 |
|
---|
| 43 | virtual int read(char* buffer, const int buffer_len);
|
---|
[22174] | 44 | virtual int write(char* buffer, const int buffer_len);
|
---|
[22173] | 45 |
|
---|
[22177] | 46 | virtual bool close_write_pipe(OSProcessWarnStatus warn_status=withWarning);
|
---|
| 47 | virtual bool close_read_pipe(OSProcessWarnStatus warn_status=withWarning);
|
---|
[22173] | 48 |
|
---|
| 49 | protected:
|
---|
[22177] | 50 |
|
---|
| 51 | static const int READ_PIPE_INDEX=0;
|
---|
| 52 | static const int WRITE_PIPE_INDEX=1;
|
---|
| 53 |
|
---|
| 54 | static const int FD_STDIN=0;
|
---|
| 55 | static const int FD_STDOUT=1;
|
---|
| 56 | static const int FD_STDERR=2;
|
---|
| 57 |
|
---|
| 58 | pid_t pid_;
|
---|
| 59 |
|
---|
[22174] | 60 | int child_stdin_write_;
|
---|
| 61 | int child_stdout_read_;
|
---|
[22173] | 62 | };
|
---|
| 63 |
|
---|
| 64 | #endif
|
---|
| 65 |
|
---|
| 66 | #endif
|
---|
| 67 |
|
---|