implement system call popen