diff options
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp index 0531a8540..43284611f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -811,6 +811,9 @@ int main(int argc, char *argv[]) _("Set password")))); allowed_options.insert(std::make_pair("go", ValueSpec(VALUETYPE_FLAG, _("Disable main menu")))); +#else + allowed_options.insert(std::make_pair("daemon", ValueSpec(VALUETYPE_FLAG, + _("Daemonize minetestserver")))); #endif Settings cmd_args; @@ -918,6 +921,12 @@ int main(int argc, char *argv[]) <<", "<<minetest_build_info <<std::endl; +#ifdef SERVER + if (cmd_args.exists("daemon")) { + porting::daemonize(); + } +#endif + /* Basic initialization */ @@ -1469,7 +1478,7 @@ int main(int argc, char *argv[]) ELL_ERROR, ELL_WARNING, ELL_INFORMATION, -#if (IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR < 8) +#if (IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR < 8) ELL_INFORMATION #else ELL_DEBUG @@ -1920,6 +1929,14 @@ int main(int argc, char *argv[]) debugstreams_deinit(); + +#ifdef SERVER + if (cmd_args.exists("daemon")) + { + porting::cleanup_pid(); + } +#endif + return retval; } |