mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Squash: Fix ingest bug. Refine AUTHORS.
This commit is contained in:
parent
85620a34f5
commit
38b0b1dab2
8 changed files with 84 additions and 60 deletions
|
@ -3526,7 +3526,7 @@ srs_error_t SrsConfig::parse_argv(int& i, char** argv)
|
|||
void SrsConfig::print_help(char** argv)
|
||||
{
|
||||
printf(
|
||||
"%s, %s, %s, created by %s\n\n"
|
||||
"%s, %s, %s, created by %sand %s\n\n"
|
||||
"Usage: %s <-h?vVgG>|<[-t] -c filename>\n"
|
||||
"Options:\n"
|
||||
" -?, -h : Show this help and exit 0.\n"
|
||||
|
@ -3539,7 +3539,7 @@ void SrsConfig::print_help(char** argv)
|
|||
" %s -t -c %s\n"
|
||||
" %s -c %s\n",
|
||||
RTMP_SIG_SRS_SERVER, RTMP_SIG_SRS_URL, RTMP_SIG_SRS_LICENSE,
|
||||
RTMP_SIG_SRS_AUTHORS,
|
||||
RTMP_SIG_SRS_AUTHORS, SRS_CONSTRIBUTORS,
|
||||
argv[0], argv[0], argv[0], SRS_CONF_DEFAULT_COFNIG_FILE,
|
||||
argv[0], SRS_CONF_DEFAULT_COFNIG_FILE);
|
||||
}
|
||||
|
|
|
@ -153,6 +153,30 @@ srs_error_t srs_redirect_output(string from_file, int to_fd)
|
|||
return err;
|
||||
}
|
||||
|
||||
srs_error_t SrsProcess::redirect_io()
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
// for the stdout, ignore when not specified.
|
||||
// redirect stdout to file if possible.
|
||||
if ((err = srs_redirect_output(stdout_file, STDOUT_FILENO)) != srs_success) {
|
||||
return srs_error_wrap(err, "redirect stdout");
|
||||
}
|
||||
|
||||
// for the stderr, ignore when not specified.
|
||||
// redirect stderr to file if possible.
|
||||
if ((err = srs_redirect_output(stderr_file, STDERR_FILENO)) != srs_success) {
|
||||
return srs_error_wrap(err, "redirect stderr");
|
||||
}
|
||||
|
||||
// No stdin for process, @bug https://github.com/ossrs/srs/issues/1592
|
||||
if ((err = srs_redirect_output("/dev/null", STDIN_FILENO)) != srs_success) {
|
||||
return srs_error_wrap(err, "redirect /dev/null");
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
srs_error_t SrsProcess::start()
|
||||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
@ -182,24 +206,13 @@ srs_error_t SrsProcess::start()
|
|||
// ignore the SIGINT and SIGTERM
|
||||
signal(SIGINT, SIG_IGN);
|
||||
signal(SIGTERM, SIG_IGN);
|
||||
|
||||
// for the stdout, ignore when not specified.
|
||||
// redirect stdout to file if possible.
|
||||
if ((err = srs_redirect_output(stdout_file, STDOUT_FILENO)) != srs_success) {
|
||||
return srs_error_wrap(err, "redirect output");
|
||||
|
||||
// redirect standard I/O, if it failed, output error to stdout, and exit child process.
|
||||
if ((err = redirect_io()) != srs_success) {
|
||||
fprintf(stdout, "child process error, %s\n", srs_error_desc(err).c_str());
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
// for the stderr, ignore when not specified.
|
||||
// redirect stderr to file if possible.
|
||||
if ((err = srs_redirect_output(stderr_file, STDERR_FILENO)) != srs_success) {
|
||||
return srs_error_wrap(err, "redirect output");
|
||||
}
|
||||
|
||||
// No stdin for process, @bug https://github.com/ossrs/srs/issues/1592
|
||||
if ((err = srs_redirect_output("/dev/null", STDIN_FILENO)) != srs_success) {
|
||||
return srs_error_wrap(err, "redirect input");
|
||||
}
|
||||
|
||||
// should never close the fd 3+, for it myabe used.
|
||||
// for fd should close at exec, use fnctl to set it.
|
||||
|
||||
|
|
|
@ -53,6 +53,9 @@ public:
|
|||
// @param argv the argv for binary path, the argv[0] generally is the binary.
|
||||
// @remark the argv[0] must be the binary.
|
||||
virtual srs_error_t initialize(std::string binary, std::vector<std::string> argv);
|
||||
private:
|
||||
// Redirect standard I/O.
|
||||
virtual srs_error_t redirect_io();
|
||||
public:
|
||||
// Start the process, ignore when already started.
|
||||
virtual srs_error_t start();
|
||||
|
|
|
@ -119,8 +119,7 @@ srs_error_t do_main(int argc, char** argv)
|
|||
|
||||
// config already applied to log.
|
||||
srs_trace2(TAG_MAIN, "%s, %s", RTMP_SIG_SRS_SERVER, RTMP_SIG_SRS_LICENSE);
|
||||
srs_trace("authors: %s", RTMP_SIG_SRS_AUTHORS);
|
||||
srs_trace("contributors: %s", SRS_CONSTRIBUTORS);
|
||||
srs_trace("authors: %sand %s", RTMP_SIG_SRS_AUTHORS, SRS_CONSTRIBUTORS);
|
||||
srs_trace("cwd=%s, work_dir=%s, build: %s, configure: %s, uname: %s, osx: %d",
|
||||
_srs_config->cwd().c_str(), cwd.c_str(), SRS_BUILD_DATE, SRS_USER_CONFIGURE, SRS_UNAME, SRS_OSX_BOOL);
|
||||
srs_trace("configure detail: " SRS_CONFIGURE);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue