aboutsummaryrefslogtreecommitdiff
path: root/src/Downloader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Downloader.cpp')
-rw-r--r--src/Downloader.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/Downloader.cpp b/src/Downloader.cpp
index 75cef1c..2c0d316 100644
--- a/src/Downloader.cpp
+++ b/src/Downloader.cpp
@@ -80,8 +80,11 @@ namespace QuickMedia {
bool CurlDownloader::stop(bool download_completed) {
if(read_program.read_fd != -1)
close(read_program.read_fd);
- if(read_program.pid != -1)
+ if(read_program.pid != -1) {
kill(read_program.pid, SIGTERM);
+ int status;
+ waitpid(read_program.pid, &status, 0);
+ }
if(!download_completed)
remove(output_filepath_tmp.data.c_str());
//header_reader.cancel();
@@ -269,8 +272,11 @@ namespace QuickMedia {
bool YoutubeDlDownloader::stop(bool) {
if(read_program_file)
fclose(read_program_file);
- if(read_program.pid != -1)
+ if(read_program.pid != -1) {
kill(read_program.pid, SIGTERM);
+ int status;
+ waitpid(read_program.pid, &status, 0);
+ }
// TODO: Remove the temporary files created by youtube-dl (if !download_completed)
//header_reader.cancel();
finished = false;