WvStreams
include
wvpty.h
1
/* -*- Mode: C++ -*-
2
* Worldvisions Weaver Software:
3
* Copyright (C) 1997-2004 Net Integration Technologies, Inc.
4
*
5
* WvStreams implementation of ptys under Linux.
6
*
7
* For more information on programming ptys, see chapter 19 of
8
* Stevens' "Advanced Programming in the UNIX Environment"
9
*/
10
#ifndef __WVPTY_H
11
#define __WVPTY_H
12
13
#include "wvfdstream.h"
14
#include "wvtr1.h"
15
16
class
WvPty
:
public
WvFDStream
17
{
18
private
:
19
WvString
_master, _slave;
20
pid_t _pid;
21
int
_exit_status;
22
23
static
bool
open_pty(
WvString
&master,
int
&master_fd,
24
WvString
&slave,
int
&slave_fd);
25
26
void
monitor_child(
bool
wait);
27
28
public
:
29
typedef
wv::function<bool(
WvPty
&)> Callback;
30
31
Callback pre_exec_cb;
32
Callback post_exec_cb;
// This can only be called if exec() fails
33
34
WvPty
(
const
char
*program,
const
char
*
const
*argv,
35
Callback _pre_exec_cb = Callback(),
36
Callback _post_exec_cb = Callback());
37
38
void
kill(
int
signum);
39
bool
child_exited();
40
bool
child_killed();
41
int
finish();
42
int
exit_status();
43
44
const
char
*master()
const
45
{
return
_master; }
46
const
char
*slave()
const
47
{
return
_slave; }
48
pid_t pid()
const
49
{
return
_pid; }
50
51
const
char
*wstype()
const
{
return
"WvPty"
; }
52
};
53
54
#endif // __WVPTY_H
WvPty
Definition:
wvpty.h:16
WvString
WvString is an implementation of a simple and efficient printable-string class.
Definition:
wvstring.h:329
WvFdStream
Base class for streams built on Unix file descriptors.
Definition:
wvfdstream.h:20
Generated by
1.8.17