From e9b5cc46f5805832c72d103bc6d8e89362a2e9da Mon Sep 17 00:00:00 2001 From: Blue Date: Tue, 9 Dec 2025 15:04:35 -0800 Subject: [PATCH] Apply PR feedback --- src/windows/wslaservice/exe/ContainerEventTracker.cpp | 3 ++- src/windows/wslaservice/exe/ContainerEventTracker.h | 2 ++ src/windows/wslaservice/exe/WSLAContainer.cpp | 2 -- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/windows/wslaservice/exe/ContainerEventTracker.cpp b/src/windows/wslaservice/exe/ContainerEventTracker.cpp index e7d5940..e81d186 100644 --- a/src/windows/wslaservice/exe/ContainerEventTracker.cpp +++ b/src/windows/wslaservice/exe/ContainerEventTracker.cpp @@ -42,6 +42,7 @@ void ContainerEventTracker::ContainerTrackingReference::Reset() { m_tracker->UnregisterContainerStateUpdates(m_id); m_tracker = nullptr; + m_id = {}; } } @@ -52,7 +53,7 @@ ContainerEventTracker::ContainerTrackingReference::~ContainerTrackingReference() ContainerEventTracker::ContainerEventTracker(WSLAVirtualMachine& virtualMachine) { - ServiceProcessLauncher launcher{"/usr/bin/nerdctl", {"/usr/bin/nerdctl", "events", "--format", "{{json .}}"}, {}, common::ProcessFlags::Stdout}; + ServiceProcessLauncher launcher{nerdctlPath, {nerdctlPath, "events", "--format", "{{json .}}"}, {}, common::ProcessFlags::Stdout}; // Redirect stderr to /dev/null to avoid pipe deadlocks. launcher.AddFd({.Fd = 2, .Type = WSLAFdTypeLinuxFileOutput, .Path = "/dev/null"}); diff --git a/src/windows/wslaservice/exe/ContainerEventTracker.h b/src/windows/wslaservice/exe/ContainerEventTracker.h index 5584ae7..20ec0a7 100644 --- a/src/windows/wslaservice/exe/ContainerEventTracker.h +++ b/src/windows/wslaservice/exe/ContainerEventTracker.h @@ -28,6 +28,8 @@ enum class ContainerEvent Destroy }; +constexpr const char* nerdctlPath = "/usr/bin/nerdctl"; + class ContainerEventTracker { public: diff --git a/src/windows/wslaservice/exe/WSLAContainer.cpp b/src/windows/wslaservice/exe/WSLAContainer.cpp index 1f13cc3..8561e2f 100644 --- a/src/windows/wslaservice/exe/WSLAContainer.cpp +++ b/src/windows/wslaservice/exe/WSLAContainer.cpp @@ -18,8 +18,6 @@ Abstract: using wsl::windows::service::wsla::WSLAContainer; -constexpr const char* nerdctlPath = "/usr/bin/nerdctl"; - // Constants for required default arguments for "nerdctl run..." static std::vector defaultNerdctlRunArgs{//"--pull=never", // TODO: Uncomment once PullImage() is implemented. "--net=host", // TODO: default for now, change later