File tree Expand file tree Collapse file tree 1 file changed +17
-14
lines changed Expand file tree Collapse file tree 1 file changed +17
-14
lines changed Original file line number Diff line number Diff line change @@ -152,20 +152,23 @@ pipeline_pipes_handle(pipe_cmds_t* pipe_commands)
152
152
char * * args1 = command_args_to_string_array (comm1 );
153
153
command_t * comm2 = pipe_commands -> cmds_list [1 ];
154
154
char * * args2 = command_args_to_string_array (comm2 );
155
- //pipe(pipefd);
156
- //if (fork() == 0) {
157
- // //child
158
- // //write
159
- // close(pipefd[0]);
160
- // dup2(pipefd[1], STDOUT_FILENO);
161
- // execvp(comm1->name, args1);
162
- //} else {
163
- // //parent
164
- // close(pipefd[1]);
165
- // dup2(pipefd[0], STDIN_FILENO);
166
- // execvp(comm2->name, args2);
167
- //}
168
- printf ("Pipes have been successfully handled\n" );
155
+ #ifdef __unix__
156
+ pipe (pipefd );
157
+ if (fork () == 0 ) {
158
+ //child
159
+ //write
160
+ close (pipefd [0 ]);
161
+ dup2 (pipefd [1 ], STDOUT_FILENO );
162
+ execvp (comm1 -> name , args1 );
163
+ } else {
164
+ //parent
165
+ close (pipefd [1 ]);
166
+ dup2 (pipefd [0 ], STDIN_FILENO );
167
+ execvp (comm2 -> name , args2 );
168
+ }
169
+ #elif _WIN32
170
+
171
+ #endif
169
172
170
173
return 0 ;
171
174
}
You can’t perform that action at this time.
0 commit comments