解决启动ffmpeg进程导致shell终端假死的问题:#1662

This commit is contained in:
xiongziliang 2022-10-29 17:44:55 +08:00
parent 9bb4b55924
commit c25e93fee3

View File

@ -58,6 +58,12 @@ static int runChildProcess(string cmd, string log_file) {
log_file = StrPrinter << log_file << "." << getpid(); log_file = StrPrinter << log_file << "." << getpid();
} }
if (isatty(STDIN_FILENO)) {
/* bb_error_msg("ignoring input"); */
close(STDIN_FILENO);
open("/dev/null", O_RDONLY, 0666); /* will be fd 0 (STDIN_FILENO) */
}
//重定向shell日志至文件 //重定向shell日志至文件
auto fp = File::create_file(log_file.data(), "ab"); auto fp = File::create_file(log_file.data(), "ab");
if (!fp) { if (!fp) {