*****************************************************************************/
bool exec_reap(void);
void exec_job(char** cmd, char* data, size_t ndata, View* dest);
-int exec_cmd(char** cmd, char* text, char** out, char** err);
+int exec_cmd(char** cmd);
int exec_spawn(char** cmd, int* in, int* out);
/* Pseudo-Terminal Handling
}
}
-int exec_cmd(char** cmd, char* text, char** out, char** err) {
+int exec_cmd(char** cmd) {
Proc proc;
if (execute(cmd, &proc) < 0) {
perror("failed to execute");
return -1;
}
- /* send the input to stdin of the command */
- if (text && write(proc.in, text, strlen(text)) < 0) {
- perror("failed to write");
- return -1;
- }
- close(proc.in);
- /* read the stderr of the command */
- if (err) *err = fdgets(proc.err);
- close(proc.err);
- /* read the stdout of the command */
- if (out) *out = fdgets(proc.out);
- close(proc.out);
/* wait for the process to finish */
int status;
waitpid(proc.pid, &status, 0);
} else {
char* text = view_fetch(win_view(id), row, col, risfile);
FetchCmd[1] = text;
- if (exec_cmd(FetchCmd, NULL, NULL, NULL) != 0) {
+ if (exec_cmd(FetchCmd) != 0) {
SearchDir *= (x11_keymodsset(ModShift) ? -1 : +1);
free(SearchTerm);
SearchTerm = view_fetch(win_view(id), row, col, risfile);