aboutsummaryrefslogtreecommitdiff
path: root/vis-subprocess.h
blob: 05f4dfea6d23f7dc0a71592af7d38e8ea2d0b44e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef VIS_SUBPROCESS_H
#define VIS_SUBPROCESS_H
#include "vis-core.h"
#include "vis-lua.h"
#include <sys/select.h>

typedef struct Process Process;
#if CONFIG_LUA
typedef int Invalidator(lua_State*);
#else
typedef void Invalidator;
#endif

struct Process {
	char *name;
	int outfd;
	int errfd;
	int inpfd;
	pid_t pid;
	Invalidator** invalidator;
	Process *next;
};

typedef enum { STDOUT, STDERR, SIGNAL, EXIT } ResponseType;

VIS_INTERNAL Process *vis_process_communicate(Vis *, const char *command, const char *name,
                                              Invalidator **invalidator);
VIS_INTERNAL int vis_process_before_tick(fd_set *);
VIS_INTERNAL void vis_process_tick(Vis *, fd_set *);
VIS_INTERNAL void vis_process_waitall(Vis *);
#endif