Skip to content

Commit e0681ed

Browse files
committed
fix(wslc): inline prerequisite error
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>\nCopilot-Session: f46e1b1d-d428-4d1b-b9c3-b83ca7b35ec2
1 parent 437d24d commit e0681ed

1 file changed

Lines changed: 5 additions & 17 deletions

File tree

src/backends/wslc/common/src/wsl_container_runner.rs

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -317,22 +317,6 @@ fn sdk_error(context: &str, hr: HRESULT, sdk_msg: &str) -> ScriptResponse {
317317
ScriptResponse::error(&msg)
318318
}
319319

320-
fn wslc_prerequisite_error(missing: WslcComponentFlags) -> String {
321-
if missing as u32 & WslcComponentFlags::WslPackage as u32 != 0 {
322-
return format!(
323-
"WSLC runtime unavailable. Missing components: {:?}. WSL 2.8.1 or newer \
324-
is required. Run `wsl --update` and check `wsl --version`.",
325-
missing
326-
);
327-
}
328-
329-
format!(
330-
"WSLC runtime not available. Missing components: {:?}. Ensure WSL2 and the \
331-
WSLC SDK are installed.",
332-
missing
333-
)
334-
}
335-
336320
impl ScriptRunner for WSLContainerRunner {
337321
fn execute(&mut self, request: &ExecutionRequest, logger: &mut Logger) -> ScriptResponse {
338322
unsafe { self.run_internal(request, logger) }
@@ -372,7 +356,11 @@ impl WSLContainerRunner {
372356
return Err(sdk_error("WslcCanRun failed", hr, ""));
373357
}
374358
if can_run == 0 {
375-
return Err(ScriptResponse::error(&wslc_prerequisite_error(missing)));
359+
return Err(ScriptResponse::error(&format!(
360+
"WSLC runtime unavailable. Missing components: {:?}. Install WSL 2.8.1 or \
361+
newer and run `wsl --update`.",
362+
missing
363+
)));
376364
}
377365
let _ = writeln!(logger, "[WSLC] Runtime check passed");
378366

0 commit comments

Comments
 (0)