Post

Replies

Boosts

Views

Activity

XCode 15: simple execv program exits with code 5 in the console.
Hello, found the following curious behaviour, If I try to run from within xcode (pressing Run) the following code: #include <unistd.h> int main(int argc, const char * argv[]) { char *args[] = {"/bin/ls", "-r", "-t", "-l", (char *) 0 }; execv(args[0], args); return 0; } the program does not print the expected list of files and folders but instead exits with: Message from debugger: Terminated due to signal 5 Program ended with exit code: 5 But if I try to run the exact same compiled program from the terminal, it works as expected. I lost so many hours wondering what I was doing wrong, but apparently it was the xcode console that does not play nice with execing? Could it be that changing the process image throws a wrench into xcode? Anybody has any idea why this could be? Thanks.
1
0
767
Oct ’23