supress aria2c stdout
This commit is contained in:
parent
4e4bb0b396
commit
5764a7698e
1 changed files with 6 additions and 1 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
#include <libowfat/errmsg.h>
|
#include <libowfat/errmsg.h>
|
||||||
|
#include <libowfat/open.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "../pkin.h"
|
#include "../pkin.h"
|
||||||
|
|
@ -7,6 +8,7 @@
|
||||||
int pkin_fetch_start(pkin_fetch_queue *queue)
|
int pkin_fetch_start(pkin_fetch_queue *queue)
|
||||||
{
|
{
|
||||||
char **fetchcmd;
|
char **fetchcmd;
|
||||||
|
int nullfd;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
if (buffer_flush(&queue->writeb) < 0) {
|
if (buffer_flush(&queue->writeb) < 0) {
|
||||||
carpsys("write to pipe");
|
carpsys("write to pipe");
|
||||||
|
|
@ -15,13 +17,16 @@ int pkin_fetch_start(pkin_fetch_queue *queue)
|
||||||
close(queue->pipefd[1]);
|
close(queue->pipefd[1]);
|
||||||
|
|
||||||
fetchcmd = (char *[]){"aria2c", "-i", "-", NULL};
|
fetchcmd = (char *[]){"aria2c", "-i", "-", NULL};
|
||||||
pid = pkin__spawn(fetchcmd, queue->pipefd[0], 1, 2);
|
nullfd = open_write("/dev/null");
|
||||||
|
pid = pkin__spawn(fetchcmd, queue->pipefd[0], nullfd < 0 ? 1 : nullfd, 2);
|
||||||
if (pid < 0) {
|
if (pid < 0) {
|
||||||
|
close(nullfd);
|
||||||
carp("failed spawning aria2c to fetch files");
|
carp("failed spawning aria2c to fetch files");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (waitpid(pid, NULL, 0) < 0) {
|
if (waitpid(pid, NULL, 0) < 0) {
|
||||||
|
close(nullfd);
|
||||||
carp("waitpid");
|
carp("waitpid");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue