summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_runtime.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2017-08-24 17:29:57 +0300
committerIgor Sysoev <igor@sysoev.ru>2017-08-24 17:29:57 +0300
commit1e53ff184c3b94e08bd17c7318ee73e2317684ad (patch)
tree4e2b464c82fc760d0caf075bf29e62dd213fb34a /src/nxt_runtime.c
parent259b90b9d707fddfd0e70672a48bd228a628b599 (diff)
downloadunit-1e53ff184c3b94e08bd17c7318ee73e2317684ad.tar.gz
unit-1e53ff184c3b94e08bd17c7318ee73e2317684ad.tar.bz2
Added command line option --version.
Diffstat (limited to 'src/nxt_runtime.c')
-rw-r--r--src/nxt_runtime.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/nxt_runtime.c b/src/nxt_runtime.c
index 4de0404c..ff4dd54d 100644
--- a/src/nxt_runtime.c
+++ b/src/nxt_runtime.c
@@ -133,6 +133,10 @@ nxt_runtime_create(nxt_task_t *task)
rt->start = nxt_runtime_initial_start;
+ if (nxt_runtime_conf_init(task, rt) != NXT_OK) {
+ goto fail;
+ }
+
nxt_work_queue_add(&task->thread->engine->fast_work_queue,
nxt_runtime_start, task, rt, NULL);
@@ -346,10 +350,6 @@ nxt_runtime_start(nxt_task_t *task, void *obj, void *data)
task->thread->log->ctx_handler = NULL;
task->thread->log->ctx = NULL;
- if (nxt_runtime_conf_init(task, rt) != NXT_OK) {
- goto fail;
- }
-
if (nxt_runtime_log_files_create(task, rt) != NXT_OK) {
goto fail;
}
@@ -797,6 +797,10 @@ nxt_runtime_conf_read_cmd(nxt_task_t *task, nxt_runtime_t *rt)
nxt_str_t addr;
nxt_sockaddr_t *sa;
+ const static char version[] =
+ "nginext version: " NXT_VERSION "\n"
+ "configured as ./configure" NXT_CONFIGURE_OPTIONS "\n";
+
argv = nxt_process_argv;
while (*argv != NULL) {
@@ -900,6 +904,11 @@ nxt_runtime_conf_read_cmd(nxt_task_t *task, nxt_runtime_t *rt)
rt->daemon = 0;
continue;
}
+
+ if (nxt_strcmp(p, "--version") == 0) {
+ write(STDERR_FILENO, version, sizeof(version) - 1);
+ exit(0);
+ }
}
return NXT_OK;