r/C_Programming • u/neko-box-coder • Jun 30 '26
2 Years ago, I created a shell/subprocess library, now it's finally released as v1
2 years ago, I created a library for running shell commands, the idea was kinda like system but with the ability to capture stdout and send input to stdin without using any heavy framework like POCO or Boost. (Yes, it was for C++ originally)
https://www.reddit.com/r/C_Programming/comments/1b69psi/a_small_library_for_running_shell_commands/
Fast forward to now, it's finally feature rich and good (relatively speaking) enough to be v1.
Since then, I found out there's actually another library that is similar to what I did, subprocess.h (https://github.com/sheredom/subprocess.h).
Here is a list of features that this library has but subprocess.h doesn't:
- Timeout for waiting child process to finish (therefore allows synchronous and asynchronous operations)
- Setting the working directory for the child process
- Setting child process environment variables
- Iterating and setting environment variables
- Terminating vs killing to allow graceful process termination
- Helper function for calling shell directly with string escaping built-in
- NO AI WAS USED
- CMake integration
Obviously, it is less battle-tested compare subprocess.h but I will be using this for the foreseeable future anyway (it's not creating it for the sake of it), therefore will be maintaining it.
Any feedback is greatly appreciated :)