search for: bg_command

Displaying 3 results from an estimated 3 matches for "bg_command".

2014 Jan 27
1
Re: [PATCH INCOMPLETE] Rewrite virt-make-fs in C (originally Perl).
...(fd, 1); > + if (stderr_to_file) > + dup2 (fd, 2); > + close (fd); > + > + execvp (argv[0], argv); > + perror ("execvp"); > + _exit (EXIT_FAILURE); > +} > + > +/* Execute a command in the background, sending output to a pipe. */ > +static int > +bg_command (char **argv, char **pipef) > +{ Reading this and other similar implementations, for example: - fish/events.c, do_event_handler - fish/fish.c, execute_and_inline and issue_command (which has a comment regarding pipe commands) - src/command.c, run_command - src/launch-direct.c, launch_direct -...
2014 Jan 27
2
[PATCH INCOMPLETE] Rewrite virt-make-fs in C (originally Perl).
I thought it would be easy to rewrite virt-make-fs in C. Two days later ... The Perl program uses a lot of external commands, which makes it pretty tedious to implement in C. Rich.
2014 Jan 27
0
[PATCH INCOMPLETE] Rewrite virt-make-fs in C (originally Perl).
...perror (tmpfile); + _exit (EXIT_FAILURE); + } + dup2 (fd, 1); + if (stderr_to_file) + dup2 (fd, 2); + close (fd); + + execvp (argv[0], argv); + perror ("execvp"); + _exit (EXIT_FAILURE); +} + +/* Execute a command in the background, sending output to a pipe. */ +static int +bg_command (char **argv, char **pipef) +{ + pid_t pid; + int status, fd; + FILE *fp; + char line[256]; + + pid = fork (); + if (pid == -1) { + perror ("fork"); + return -1; + } + if (pid > 0) { + if (waitpid (pid, &status, 0) == -1) { + perror ("waitpid"); +...