mirror of
https://repo.dec05eba.com/gpu-screen-recorder-ui
synced 2026-04-13 06:06:46 +09:00
Run gpu screen recorder as a child process, show notification on start/stop
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user