~ruther/CTU-FEE-B0B35APO-Semestral-project

ref: 61727753cc0b74adb9be0fcdb4accfe47a1af0f3 CTU-FEE-B0B35APO-Semestral-project/file-browser/include/file_execute.h -rw-r--r-- 1.2 KiB
61727753 — František Boháček feat: add list container selected index, padding and colors 3 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <unistd.h>
#include <stdbool.h>

/**
 * @brief This structure holds information about executing subprocess
 * 
 */
typedef struct {
  pid_t pid;/**< PID of the running process */
  int output_signal;/**< Exit code of the process*/
  bool exited;/**< Whether the process has ended */
} executing_file_t;

/**
 * @brief This structure holds error or executing subprocess
 * 
 */
typedef struct {
  bool error; /**< in case there was an error, this is true*/
  executing_file_t file; /**< executing file if error is false*/
} executing_file_error_t;

/**
 * @brief Start executing given file
 * 
 * @param path path to the executable
 * @param args arguments to start the executable with
 * @return executing_file_error_t with either error or process information set
 */
executing_file_error_t executing_file_execute(char *path, char *args);

/**
 * @brief Wait for the process to exit
 * 
 * @param file 
 * @return int exit code
 */
int executing_file_wait(executing_file_t *file);

/**
 * @brief Check whether the process has ended and return immediatelly
 * 
 * @param file 
 * @return true when the process has ended
 * @return false when the process is still running
 */
bool executing_file_has_ended(executing_file_t *file);
Do not follow this link