Apply PR feedback

This commit is contained in:
Blue 2025-12-02 11:45:49 -08:00
parent 61bca24c7b
commit 6fc68e8999
2 changed files with 10 additions and 8 deletions

View File

@ -11,7 +11,9 @@ Abstract:
This file contains the definition for WSLAContainerLauncher. This file contains the definition for WSLAContainerLauncher.
--*/ --*/
#include "WSLAprocessLauncher.h"
#pragma once
#include "WSLAProcessLauncher.h"
namespace wsl::windows::common { namespace wsl::windows::common {

View File

@ -21,10 +21,11 @@ using wsl::windows::service::wsla::WSLAContainer;
constexpr const char* nerdctlPath = "/usr/bin/nerdctl"; constexpr const char* nerdctlPath = "/usr/bin/nerdctl";
// Constants for required default arguments for "nerdctl run..." // Constants for required default arguments for "nerdctl run..."
static std::vector<std::string> defaultNerdctlRunArgs{//"--pull=never", // TODO: Uncomment once PullImage() is implemented. static std::vector<std::string> defaultNerdctlRunArgs{
"--net=host", // TODO: default for now, change later //"--pull=never", // TODO: Uncomment once PullImage() is implemented.
"--ulimit", "--net=host", // TODO: default for now, change later
"nofile=65536:65536"}; "--ulimit",
"nofile=65536:65536"};
HRESULT WSLAContainer::Start() HRESULT WSLAContainer::Start()
{ {
@ -116,7 +117,7 @@ std::vector<std::string> WSLAContainer::PrepareNerdctlRunCommand(const WSLA_CONT
args.push_back(options.Name); args.push_back(options.Name);
if (options.ShmSize > 0) if (options.ShmSize > 0)
{ {
args.push_back("--shm-size=" + std::to_string(options.ShmSize) + 'm'); args.push_back(std::format("--shm-size={}m", options.ShmSize));
} }
if (options.Flags & WSLA_CONTAINER_FLAG_ENABLE_GPU) if (options.Flags & WSLA_CONTAINER_FLAG_ENABLE_GPU)
{ {
@ -133,7 +134,7 @@ std::vector<std::string> WSLAContainer::PrepareNerdctlRunCommand(const WSLA_CONT
THROW_HR_IF_MSG( THROW_HR_IF_MSG(
E_INVALIDARG, E_INVALIDARG,
options.InitProcessOptions.Environment[i][0] == L'-', options.InitProcessOptions.Environment[i][0] == L'-',
"Invlaid environment string: %hs", "Invalid environment string: %hs",
options.InitProcessOptions.Environment[i]); options.InitProcessOptions.Environment[i]);
args.insert(args.end(), {"-e", options.InitProcessOptions.Environment[i]}); args.insert(args.end(), {"-e", options.InitProcessOptions.Environment[i]});
@ -161,6 +162,5 @@ std::vector<std::string> WSLAContainer::PrepareNerdctlRunCommand(const WSLA_CONT
} }
} }
return args; return args;
} }