Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions wshell.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ void proc(void)
while(TRUE)
{
int pipe_fd[2],in_fd,out_fd;
int ret;
type_prompt(prompt);
ParaNum = read_command(&command,parameters,prompt);
if(-1 == ParaNum)
Expand All @@ -89,7 +90,12 @@ void proc(void)
close(fileno(stdin));
dup2(pipe_fd[0], fileno(stdin));
close(pipe_fd[0]);
execvp(info.command2,info.parameters2);
ret = execvp(info.command2,info.parameters2);
if(ret < 0)
{
perror("command error");
exit(-1);
}
}
else
{
Expand Down Expand Up @@ -164,7 +170,12 @@ void proc(void)
dup2(in_fd, fileno(stdin));
close(in_fd);
}
execvp(command,parameters);
ret = execvp(command,parameters);
if(ret < 0)
{
perror("command error");
exit(-1);
}
}
}
free(parameters);
Expand Down