try to get pipes w io redir

This commit is contained in:
Ben Harris 2016-11-16 13:49:00 -05:00
parent b0b12d9fe9
commit f05259439a
2 changed files with 4 additions and 4 deletions

View File

@ -55,7 +55,7 @@ void check_cmd_io(simple_command *cmd) {
} }
return; return;
} }
else { // else {
if (cmd->infile != "") { if (cmd->infile != "") {
cmd->infd = open(cmd->infile.c_str(), O_RDONLY); cmd->infd = open(cmd->infile.c_str(), O_RDONLY);
if (cmd->infd < 0) { if (cmd->infd < 0) {
@ -81,14 +81,12 @@ void check_cmd_io(simple_command *cmd) {
} }
} }
else cmd->outfd = 1; else cmd->outfd = 1;
} // }
} }
// http://www.gnu.org/software/libc/manual/html_node/Wordexp-Example.html // http://www.gnu.org/software/libc/manual/html_node/Wordexp-Example.html
int expand_and_execute (simple_command *cmd) { int expand_and_execute (simple_command *cmd) {
const char *program = cmd->vargs[0].c_str(); const char *program = cmd->vargs[0].c_str();

View File

@ -8,6 +8,7 @@
#include <vector> #include <vector>
using namespace std; using namespace std;
// method definitions // method definitions
void ctrlCHandler(int sig); void ctrlCHandler(int sig);
vector<string> split(const char *str, char c = ' '); vector<string> split(const char *str, char c = ' ');
@ -17,4 +18,5 @@ void check_cmd_io(simple_command *cmd);
int expand_and_execute (simple_command *cmd); int expand_and_execute (simple_command *cmd);
bool remap_pipe_stdin_stdout(int rpipe, int wpipe); bool remap_pipe_stdin_stdout(int rpipe, int wpipe);
#endif #endif