add threadsafe popen pclose