Permalink
Browse files

flush gflags output

last stab at #5999
  • Loading branch information...
rt
rt committed Nov 25, 2018
1 parent 0a80d32 commit 2d04e27ef166a046c9e1440e9a97e103a9d3b976
Showing with 12 additions and 6 deletions.
  1. +3 −5 rts/System/SpringApp.cpp
  2. +9 −1 rts/lib/gflags/src/gflags.cc
@@ -167,11 +167,9 @@ static void ConsolePrintInitialize(const std::string& configSource, bool safemod
*/
SpringApp::SpringApp(int argc, char** argv)
{
// {--,/}help overrides all other flags and causes exit(),
// even in the unusual event it is not given as first arg
if (argc > 1 && strstr(argv[1], "help") != nullptr)
ConsolePrintInitialize("", false);
// NB
// {--,/}help overrides all other flags and causes exit(),
// even in the unusual event it is not given as first arg
gflags::SetUsageMessage("Usage: " + std::string(argv[0]) + " [options] [path_to_script.txt or demo.sdfz]");
gflags::SetVersionString(SpringVersion::GetFull());
gflags::ParseCommandLineFlags(&argc, &argv, true);
@@ -135,8 +135,16 @@ using std::sort;
using std::string;
using std::vector;
static void flush_exit(int ec) {
// exit(1) is not a normal termination, force a flush
std::fflush(stdout);
std::exit(ec);
}
// This is used by the unittest to test error-exit code
void GFLAGS_DLL_DECL (*gflags_exitfunc)(int) = &exit; // from stdlib.h
// void GFLAGS_DLL_DECL (*gflags_exitfunc)(int) = &exit; // from stdlib.h
//SPRING
void GFLAGS_DLL_DECL (*gflags_exitfunc)(int) = &flush_exit;
// The help message indicating that the commandline flag has been

0 comments on commit 2d04e27

Please sign in to comment.