~emersion/mrsh

ref: 1c6cbcf40da4e92c3c4fc5a2bb86b86d60accef1 mrsh/include/shell/task_command.h -rw-r--r-- 678 bytes
1c6cbcf4emersion ci: add an optimized build 2 years ago
                                                                                
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
32
#ifndef SHELL_TASK_COMMAND_H
#define SHELL_TASK_COMMAND_H

#include "shell/process.h"
#include "shell/task.h"

enum task_command_type {
	TASK_COMMAND_PROCESS,
	TASK_COMMAND_BUILTIN,
	TASK_COMMAND_FUNCTION,
};

struct task_command {
	struct task task;
	struct mrsh_simple_command *sc;
	bool started;
	enum task_command_type type;
	struct mrsh_array args;

	// if a process
	struct process process;

	// if a function
	const struct mrsh_function *fn_def;
	struct task *fn_task;
};

int task_process_poll(struct task *task, struct context *ctx);
int task_builtin_poll(struct task *task, struct context *ctx);
int task_function_poll(struct task *task, struct context *ctx);

#endif