Make container id required for stop command (#41108)
David Bennett committed
Jul 23, 2026 at 13:08 UTC
2de0139ec87457a113a8d0f066c01e2fd576746a
2 files changed
+3
-2
src/windows/wslc/commands/ContainerStopCommand.cpp
+1
-1
@@ -27,7 +27,7 @@ namespace wsl::windows::wslc {
27
std::vector<Argument> ContainerStopCommand::GetArguments() const
28
{
29
return {
30
- Argument::Create(ArgType::ContainerId, std::nullopt, NO_LIMIT),
30
+ Argument::Create(ArgType::ContainerId, true, NO_LIMIT),
31
Argument::Create(ArgType::Signal),
32
Argument::Create(ArgType::Time),
33
};
test/windows/wslc/CommandLineTestCases.h
+2
-1
@@ -95,7 +95,8 @@ COMMAND_LINE_TEST_CASE(L"container run ubuntu", L"run", true)
95
COMMAND_LINE_TEST_CASE(L"container run --cidfile C:\\temp\\cidfile ubuntu", L"run", true)
96
COMMAND_LINE_TEST_CASE(L"container run -it --name foo ubuntu", L"run", true)
97
COMMAND_LINE_TEST_CASE(L"container run --rm -it --name foo ubuntu", L"run", true)
98
-COMMAND_LINE_TEST_CASE(L"stop", L"stop", true)
98
+COMMAND_LINE_TEST_CASE(L"stop", L"stop", false) // Missing required container-id positional
99
+COMMAND_LINE_TEST_CASE(L"container stop", L"stop", false) // Missing required container-id positional
100
COMMAND_LINE_TEST_CASE(L"container stop cont1 --signal 9", L"stop", true)
101
COMMAND_LINE_TEST_CASE(L"container stop cont1 --signal SIGALRM", L"stop", true)
102
COMMAND_LINE_TEST_CASE(L"container stop cont1 --signal sigkill", L"stop", true)