diff options
| author | Noah Watkins <noahwatkins@gmail.com> | 2017-02-21 16:44:22 -0800 |
|---|---|---|
| committer | Noah Watkins <noahwatkins@gmail.com> | 2017-02-21 16:44:22 -0800 |
| commit | 44a5b03841e34154e824fcc7773c458326a3487f (patch) | |
| tree | 81972023edaccef77cd322a1e2e33caef677da02 | |
| parent | e960be55ed0116aad1539822be7098a5215902dd (diff) | |
| download | monzero-core-44a5b03841e34154e824fcc7773c458326a3487f.tar.gz monzero-core-44a5b03841e34154e824fcc7773c458326a3487f.tar.xz monzero-core-44a5b03841e34154e824fcc7773c458326a3487f.zip | |
create a foreground non-interactive mode
Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
| -rw-r--r-- | src/daemon/executor.cpp | 7 | ||||
| -rw-r--r-- | src/daemon/executor.h | 4 | ||||
| -rw-r--r-- | src/daemonizer/posix_daemonizer.inl | 9 |
3 files changed, 20 insertions, 0 deletions
diff --git a/src/daemon/executor.cpp b/src/daemon/executor.cpp index ac5803cfb..20217f2f4 100644 --- a/src/daemon/executor.cpp +++ b/src/daemon/executor.cpp @@ -63,6 +63,13 @@ namespace daemonize return t_daemon{vm}; } + bool t_executor::run_non_interactive( + boost::program_options::variables_map const & vm + ) + { + return t_daemon{vm}.run(false); + } + bool t_executor::run_interactive( boost::program_options::variables_map const & vm ) diff --git a/src/daemon/executor.h b/src/daemon/executor.h index a6b47b93d..ef71a8032 100644 --- a/src/daemon/executor.h +++ b/src/daemon/executor.h @@ -56,6 +56,10 @@ namespace daemonize boost::program_options::variables_map const & vm ); + bool run_non_interactive( + boost::program_options::variables_map const & vm + ); + bool run_interactive( boost::program_options::variables_map const & vm ); diff --git a/src/daemonizer/posix_daemonizer.inl b/src/daemonizer/posix_daemonizer.inl index 926f0a3ac..aa1efb467 100644 --- a/src/daemonizer/posix_daemonizer.inl +++ b/src/daemonizer/posix_daemonizer.inl @@ -43,6 +43,10 @@ namespace daemonizer "detach" , "Run as daemon" }; + const command_line::arg_descriptor<bool> arg_non_interactive = { + "non-interactive" + , "Run non-interactive" + }; } inline void init_options( @@ -51,6 +55,7 @@ namespace daemonizer ) { command_line::add_arg(normal_options, arg_detach); + command_line::add_arg(normal_options, arg_non_interactive); } inline boost::filesystem::path get_default_data_dir() @@ -79,6 +84,10 @@ namespace daemonizer auto daemon = executor.create_daemon(vm); return daemon.run(); } + else if (command_line::has_arg(vm, arg_non_interactive)) + { + return executor.run_non_interactive(vm); + } else { //LOG_PRINT_L0("Monero '" << MONERO_RELEASE_NAME << "' (v" << MONERO_VERSION_FULL); |
