52:e9edc3bd0301 | 53:1c80ba4a0d62 |
---|---|
106 } | 106 } |
107 | 107 |
108 // wait for the process to completely finish | 108 // wait for the process to completely finish |
109 int status = -1; | 109 int status = -1; |
110 waitpid(pid, &status, 0); | 110 waitpid(pid, &status, 0); |
111 | 111 if (WIFEXITED(status)) { |
112 return status; | 112 return WEXITSTATUS(status); |
113 } else { | |
114 return -1; | |
115 } | |
113 } else { | 116 } else { |
114 perror("fork"); | 117 perror("fork"); |
115 return -1; | 118 return -1; |
116 } | 119 } |
117 } | 120 } |