If i run this code in xcode ,sleep return when child process exit in just 1 second;but when i make and run this code in terminal,it will sleep 10 seconds;why??
int main(int argc, const char * argv[])
{
pid_t pid;
if ((pid = fork()) ==0) {
sleep(1);
}else{
sleep(10);
printf("hello");
}
return 0;
}