diff --git a/src/box/box.cc b/src/box/box.cc index fab05906bbe82d36d69012fb55f1dbe14cefbbda..1a61f5cb6ea8290a1cbe0b7827a993b5648031a4 100644 --- a/src/box/box.cc +++ b/src/box/box.cc @@ -496,6 +496,10 @@ box_snapshot(void) if (snapshot_pid) return EINPROGRESS; + /* flush buffers to avoid multiple output */ + /* https://github.com/tarantool/tarantool/issues/366 */ + fflush(stdout); + fflush(stderr); pid_t p = fork(); if (p < 0) { say_syserror("fork"); diff --git a/src/box/replication.cc b/src/box/replication.cc index 2651e5d6522be37f126cfa44c3881015ab5791da..9123146da91493b174f71dd21a01d2df138be61f 100644 --- a/src/box/replication.cc +++ b/src/box/replication.cc @@ -172,6 +172,10 @@ replication_prefork(const char *snap_dir, const char *wal_dir) panic_syserror("socketpair"); assert(sockpair[0] != STDOUT_FILENO && sockpair[0] != STDERR_FILENO); + /* flush buffers to avoid multiple output */ + /* https://github.com/tarantool/tarantool/issues/366 */ + fflush(stdout); + fflush(stderr); /* create spawner */ pid_t pid = fork(); if (pid == -1) @@ -513,6 +517,10 @@ spawner_sigchld_handler(int signo __attribute__((unused))) static int spawner_create_replication_relay() { + /* flush buffers to avoid multiple output */ + /* https://github.com/tarantool/tarantool/issues/366 */ + fflush(stdout); + fflush(stderr); pid_t pid = fork(); if (pid < 0) { diff --git a/src/say.cc b/src/say.cc index 3cba2d42aadb40e940f3fa66c15aa73a1fc8b171..aa46db152a0242bc8bae8b84806bda9dbb555e53 100644 --- a/src/say.cc +++ b/src/say.cc @@ -115,6 +115,10 @@ say_init_pipe() goto error; } + /* flush buffers to avoid multiple output */ + /* https://github.com/tarantool/tarantool/issues/366 */ + fflush(stdout); + fflush(stderr); logger_pid = fork(); if (logger_pid == -1) { say_syserror("pipe"); diff --git a/src/tarantool.cc b/src/tarantool.cc index fe46976d6d68313a73ac48e47aa2c6b2219a0dbf..8b189546fb27ca11d4a1150be112b2e8e38b34f9 100644 --- a/src/tarantool.cc +++ b/src/tarantool.cc @@ -352,6 +352,10 @@ create_pid(void) static void background() { + /* flush buffers to avoid multiple output */ + /* https://github.com/tarantool/tarantool/issues/366 */ + fflush(stdout); + fflush(stderr); switch (fork()) { case -1: goto error; diff --git a/src/util.cc b/src/util.cc index 375fb87a757440908754c342eb841f8a2ddb4a09..6f30246714bc5ec326ab80fce74530f10adcb6aa 100644 --- a/src/util.cc +++ b/src/util.cc @@ -110,6 +110,10 @@ coredump(int dump_interval) last_coredump = now; + /* flush buffers to avoid multiple output */ + /* https://github.com/tarantool/tarantool/issues/366 */ + fflush(stdout); + fflush(stderr); if (fork() == 0) { close_all_xcpt(0); #ifdef ENABLE_GCOV diff --git a/test/app/cfg.result b/test/app/cfg.result index 6aaed551faf0a65885339d8519fb2fd9e861d6a9..95ae0c7b722267ffe46671ff400ca4330fdbedb2 100644 --- a/test/app/cfg.result +++ b/test/app/cfg.result @@ -1,3 +1,2 @@ false [string "-- load_cfg.lua - internal file..."]:97: Please call box.cfg{} first true table -false [string "-- load_cfg.lua - internal file..."]:97: Please call box.cfg{} first diff --git a/test/app/pcall.result b/test/app/pcall.result index 38429cee4f3dd09d68120c3431823f0cf01a2f86..3d1c5592957d4b0bb541596026de2291a6c0bb4e 100644 --- a/test/app/pcall.result +++ b/test/app/pcall.result @@ -7,7 +7,3 @@ pcall with Lua error(): false some message pcall with box.error(): false Illegal parameters, some message pcall with no return: 1 pcall with multireturn: true 1 2 3 --------------------------------------------------------------------------------- --- #267: Bad exception catching --------------------------------------------------------------------------------- -