aboutsummaryrefslogtreecommitdiff
path: root/vis-subprocess.h
blob: 79a043e9a29e9ae164e752347f76adf130dc2a8a (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;

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