1 #ifndef CONNECT___NCBI_PIPE__HPP
2 #define CONNECT___NCBI_PIPE__HPP
45 #if !defined(NCBI_OS_MSWIN) && !defined(NCBI_OS_UNIX)
46 # error "Class CPipe is only supported on Windows and Unix"
88 fStdOut_Close = 0x002,
91 fStdErr_Share = 0x008,
92 fStdErr_StdOut = 0x080,
100 fKillOnClose = 0x020,
105 fSigPipe_Restore = 0x040,
127 CPipe(
size_t pipe_size = 0);
151 const vector<string>& args,
154 const char*
const envp[] = 0,
155 size_t pipe_size = 0);
200 const vector<string>& args,
203 const char*
const envp[] = 0,
204 size_t pipe_size = 0);
302 EChildIOHandle from_handle =
eDefault);
319 size_t* written = 0);
343 TChildPollMask Poll(TChildPollMask
mask,
const STimeout* timeout = 0);
486 static EFinish ExecWait(
const string&
cmd,
487 const vector<string>& args,
493 const char*
const envp[] = 0,
494 IProcessWatcher* watcher = 0,
496 size_t pipe_size = 0);
541 virtual const char* GetErrCodeString(
void)
const override;
Helper hook-up class that installs default logging/registry/locking (but only if they have not yet be...
Callback interface for ExecWait()
std::ofstream out("events_result.xml")
main entry point for tests
#define EXCEPTION_VIRTUAL_BASE
Do not use virtual base classes in exception declaration at all, because in this case derived class s...
void Read(CObjectIStream &in, TObjectPtr object, const CTypeRef &type)
void Write(CObjectOStream &out, TConstObjectPtr object, const CTypeRef &type)
virtual EAction Watch(TProcessHandle)=0
This method is getting called periodically during the process execution by the ExecWait() method.
EIO_Status m_ReadStatus
Last read status.
EChildIOHandle m_ReadHandle
Default handle used for read.
EChildIOHandle
Which of the child I/O handles to use.
EFinish
ExecWait return code.
unsigned int TChildPollMask
bitwise OR of "EChildIOHandle"
ECreateFlag
Flags for creating standard I/O handles of the child process.
virtual EAction OnStart(TProcessHandle)
This method is called when the process has just been started by the ExecWait() method.
EChildIOHandle GetReadHandle(void) const
Get standard output handle to read data from.
const STimeout * m_ReadTimeout
eIO_Read timeout
EAction
An action which the ExecWait() method should take after the Watch() method has returned.
size_t m_PipeSize
Pipe size.
STimeout m_CloseTimeoutValue
Storage for m_CloseTimeout.
STimeout m_WriteTimeoutValue
Storage for m_WriteTimeout.
CPipeHandle * m_PipeHandle
Internal OS-specific pipe handle.
STimeout m_ReadTimeoutValue
Storage for m_ReadTimeout.
const STimeout * m_CloseTimeout
eIO_Close timeout
NCBI_EXCEPTION_DEFAULT(CPipeException, CCoreException)
unsigned int TCreateFlags
bitwise OR of "ECreateFlag"
EIO_Status m_WriteStatus
Last write status.
const STimeout * m_WriteTimeout
eIO_Write timeout
EErrCode
Error types for pipe exceptions.
@ eDone
Process finished normally.
@ eContinue
Continue running.
@ eStop
Kill the child process and exit.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
EIO_Event
I/O event (or direction).
#define NCBI_XCONNECT_EXPORT
Defines process management classes.
std::istream & in(std::istream &in_, double &x_)
@ eCanceled
Request canceled.