WslLaunchInteractive function wslapi
Launches an interactive Windows Subsystem for Linux (WSL) process in the context of a particular distribution.
Throws a WindowsException on failure.
To learn more, see learn.microsoft.com/windows/win32/api/wslapi/nf-wslapi-wsllaunchinteractive.
Implementation
int WslLaunchInteractive(
PCWSTR distributionName,
PCWSTR? command,
bool useCurrentWorkingDirectory,
) {
final exitCode = adaptiveCalloc<Uint32>();
final hr$ = HRESULT(
_WslLaunchInteractive(
distributionName,
command ?? nullptr,
useCurrentWorkingDirectory ? TRUE : FALSE,
exitCode,
),
);
if (hr$.isError) {
free(exitCode);
throw WindowsException(hr$);
}
final result$ = exitCode.value;
free(exitCode);
return result$;
}