Apply PR feedback

This commit is contained in:
Blue 2025-12-09 15:04:35 -08:00
parent 7cf58493ee
commit e9b5cc46f5
3 changed files with 4 additions and 3 deletions

View File

@ -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"});

View File

@ -28,6 +28,8 @@ enum class ContainerEvent
Destroy
};
constexpr const char* nerdctlPath = "/usr/bin/nerdctl";
class ContainerEventTracker
{
public:

View File

@ -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<std::string> defaultNerdctlRunArgs{//"--pull=never", // TODO: Uncomment once PullImage() is implemented.
"--net=host", // TODO: default for now, change later