Alternative for API system() in multi-threaded app