program zatrzymuje się po execvp (command.argv [0], command.argv)

Piszę mały program powłoki, który przyjmuje polecenie i wykonuje je. Jeśli użytkownik wprowadzi niepoprawne polecenie, instrukcja if zwraca -1. Jeśli polecenie jest poprawne, wykonuje polecenie, jednak po wykonaniu polecenia program się kończy. Co robię źle, że nie wykonuje linii kodu po nim? Przetestowałem execvp (command.argv [0], command.argv) poleceniami ls i cat, więc jestem pewien, że działa. Oto mój kod.

<code>  int shell(char *cmd_str ){
  int commandLength=0;
  cmd_t command;
  commandLength=make_cmd(cmd_str,  command);
  cout<< commandLength<<endl;
  cout << command.argv[0]<< endl;
  if( execvp( command.argv[0], command.argv)==-1)
//if the command it executed nothing runs after this line
  {
    commandLength=-1;

}else
{
  cout<<"work"<<endl;
}

  cout<< commandLength<<endl;
   return commandLength;


}
</code>

questionAnswers(3)

yourAnswerToTheQuestion