aboutsummaryrefslogtreecommitdiff
path: root/zen/cmds/status.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2022-12-07 11:36:54 +0100
committerGitHub <[email protected]>2022-12-07 02:36:54 -0800
commitcce239c1d535e047d412ec2ad5ed28ff30d5c955 (patch)
tree59dc18c2c6860d40277f8067e7de6e2e73b003d7 /zen/cmds/status.cpp
parentoptimizations (#200) (diff)
downloadarchived-zen-cce239c1d535e047d412ec2ad5ed28ff30d5c955.tar.xz
archived-zen-cce239c1d535e047d412ec2ad5ed28ff30d5c955.zip
Zen cmd fixes (#201)
* updated drop command to support namespaces * fixed hash command error message * fix output of status (and top) command * Use ZEN_CONSOLE for output in zen commands * changelog
Diffstat (limited to 'zen/cmds/status.cpp')
-rw-r--r--zen/cmds/status.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/zen/cmds/status.cpp b/zen/cmds/status.cpp
index 10970e3c2..23c27f9f9 100644
--- a/zen/cmds/status.cpp
+++ b/zen/cmds/status.cpp
@@ -3,6 +3,9 @@
#include "status.h"
#include <zencore/logging.h>
+#include <zencore/string.h>
+#include <zencore/uid.h>
+#include <zenutil/zenserverprocess.h>
namespace zen {
@@ -17,6 +20,21 @@ StatusCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
{
ZEN_UNUSED(GlobalOptions, argc, argv);
+ ZenServerState State;
+ if (!State.InitializeReadOnly())
+ {
+ ZEN_CONSOLE("no Zen state found");
+
+ return 0;
+ }
+
+ ZEN_CONSOLE("{:>5} {:>6} {:>24}", "port", "pid", "session");
+ State.Snapshot([&](const ZenServerState::ZenServerEntry& Entry) {
+ StringBuilder<25> SessionStringBuilder;
+ Entry.GetSessionId().ToString(SessionStringBuilder);
+ ZEN_CONSOLE("{:>5} {:>6} {:>24}", Entry.EffectiveListenPort, Entry.Pid, SessionStringBuilder.ToString());
+ });
+
return 0;
}