Run gpu screen recorder as a child process, show notification on start/stop

This commit is contained in:
dec05eba
2024-08-02 01:23:48 +02:00
parent 495bd6bed8
commit b094002c5b
3 changed files with 108 additions and 73 deletions

View File

@@ -40,6 +40,24 @@ namespace gsr {
return true;
}
pid_t exec_program(const char **args) {
/* 1 argument */
if(args[0] == nullptr)
return -1;
pid_t pid = vfork();
if(pid == -1) {
perror("Failed to vfork");
return -1;
} else if(pid == 0) { /* child */
execvp(args[0], (char* const*)args);
perror("execvp");
_exit(127);
} else { /* parent */
return pid;
}
}
static bool is_number(const char *str) {
while(*str) {
char c = *str;