calling an external program + capture output?
Is it possible to run a program through the command interpreter and capture its output as well as the return code? (without having to resort to piping the output to a file and reading that file... as I would imagine it to be very expensive (as if calling the command interpreter is not expensive enough))
I want it to be as efficient as possible. (can be Linux/POSIX-only, as it's a kind of low level thing)
I am aware that doing something like this should be avoided for portability and performance among other reasons, but this is the only viable option in my case.
What I am trying to do is to make a virtual versioned FUSE (filesystem in userspace) file system using git to do the hard work. There is indeed a libgit.a library, but it doesn't seem practical to use it currently because 1) as someone else pointed out, most of the git functions call exit() on error. and 2) there is no API documentation anywhere to be found.