aboutsummaryrefslogtreecommitdiff
path: root/src/Program.cpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-06-25 12:44:53 +0200
committerdec05eba <dec05eba@protonmail.com>2021-06-25 12:44:53 +0200
commit38202de4f953fca28aa884246ced0aadf0d25a4d (patch)
tree7a0a35a32404f1929238444d13a6c626856cc791 /src/Program.cpp
parent738f2b1a89a5445a1f0f94229f2fc0637b7c4e71 (diff)
Add a http server proxy for better youtube downloading (bypassing rate limit cased by http range header). Fix youtube live streams
Diffstat (limited to 'src/Program.cpp')
-rw-r--r--src/Program.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/Program.cpp b/src/Program.cpp
index 5220a4c..57d7c61 100644
--- a/src/Program.cpp
+++ b/src/Program.cpp
@@ -76,6 +76,9 @@ public:
thread_local CurrentThreadProgram current_thread_program;
int exec_program_pipe(const char **args, ReadProgram *read_program) {
+ read_program->pid = -1;
+ read_program->read_fd = -1;
+
/* 1 arguments */
if(args[0] == NULL)
return -1;
@@ -192,8 +195,9 @@ int exec_program(const char **args, ProgramOutputCallback output_callback, void
int wait_program(pid_t process_id) {
int status;
if(waitpid(process_id, &status, 0) == -1) {
+ int err = -errno;
perror("waitpid failed");
- return -errno;
+ return err;
}
if(!WIFEXITED(status))
@@ -206,8 +210,9 @@ int wait_program_non_blocking(pid_t process_id, int *status) {
int s;
int wait_result = waitpid(process_id, &s, WNOHANG);
if(wait_result == -1) {
+ int err = -errno;
perror("waitpid failed");
- *status = -errno;
+ *status = err;
return 0;
} else if(wait_result == 0) {
/* the child process is still running */