I’ve tried using system in the beginning and then migrating to execvp. But in the end, the function that checks for access on a command is the one failing.
Here are my logs:
[your-program] $ 'exe with space' /tmp/bar/f1
[your-program] 'exe with space': command not found
I was able to solve it! I’ll post the solution so maybe it will help someone else.
Using system to execute a command with quotes will run fine, I suppose that using one of the exec family should too.
The problem was the access checking, because the function I was using, access, won’t find a file on the path while using quotes. E.G. a path check with /usr/bin/‘exe with quotes’ will fail, but if it has the quotes removed /usr/bin/exe with quotes will succeed.