aboutsummaryrefslogtreecommitdiff
path: root/src/zen/cmds/status.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2023-05-02 10:01:47 +0200
committerGitHub <[email protected]>2023-05-02 10:01:47 +0200
commit075d17f8ada47e990fe94606c3d21df409223465 (patch)
treee50549b766a2f3c354798a54ff73404217b4c9af /src/zen/cmds/status.cpp
parentfix: bundle shouldn't append content zip to zen (diff)
downloadarchived-zen-075d17f8ada47e990fe94606c3d21df409223465.tar.xz
archived-zen-075d17f8ada47e990fe94606c3d21df409223465.zip
moved source directories into `/src` (#264)
* moved source directories into `/src` * updated bundle.lua for new `src` path * moved some docs, icon * removed old test trees
Diffstat (limited to 'src/zen/cmds/status.cpp')
-rw-r--r--src/zen/cmds/status.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/zen/cmds/status.cpp b/src/zen/cmds/status.cpp
new file mode 100644
index 000000000..23c27f9f9
--- /dev/null
+++ b/src/zen/cmds/status.cpp
@@ -0,0 +1,41 @@
+// Copyright Epic Games, Inc. All Rights Reserved.
+
+#include "status.h"
+
+#include <zencore/logging.h>
+#include <zencore/string.h>
+#include <zencore/uid.h>
+#include <zenutil/zenserverprocess.h>
+
+namespace zen {
+
+StatusCommand::StatusCommand()
+{
+}
+
+StatusCommand::~StatusCommand() = default;
+
+int
+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;
+}
+
+} // namespace zen