int DumpUtils::dump_command( const char *dest, int timeout, const char *command, ...) { |
int fd, fd_bak; |
fd = open(dest, O_WRONLY|O_CREAT); |
if (fd < 0) |
return -1; |
pthread_mutex_lock(&mStdoutLock); |
fd_bak = dup(1); |
dup2(fd, 1); |
va_list ap; |
va_start (ap, command); |
v_run_command( "test" , timeout, command, ap); |
va_end (ap); |
dup2(fd_bak, 1); |
pthread_mutex_unlock(&mStdoutLock); |
close(fd); |
return 0; |
} |
by: 发表于:2017-06-20 16:14:34 顶(0) | 踩(0) 回复
??
回复评论