@@ -33,9 +33,8 @@ export type RunWslOptions = {
3333const DEFAULT_WSL_TIMEOUT_MS = 20_000
3434const DEFAULT_WSL_INSTALL_TIMEOUT_MS = 15 * 60_000
3535
36- export function wslArgs ( args : string [ ] , distro ?: string | null ) {
37- if ( distro ) return [ "-d" , distro , "--" , ...args ]
38- return [ "--" , ...args ]
36+ export function wslArgs ( args : string [ ] , distro ?: string | null , user ?: string | null ) {
37+ return [ ...( distro ? [ "-d" , distro ] : [ ] ) , ...( user ? [ "--user" , user ] : [ ] ) , "--" , ...args ]
3938}
4039
4140export function runWsl ( args : string [ ] , opts : RunWslOptions = { } ) {
@@ -333,7 +332,7 @@ export async function readWslCommandVersion(command: string, distro: string, opt
333332export async function upgradeWslOpencode ( target : string , command : string , distro : string , opts ?: RunWslOptions ) {
334333 return runInteractiveCommand (
335334 resolveSystem32Command ( "wsl.exe" ) ,
336- wslArgs ( [ "bash" , "-lc" , `${ shellEscape ( command ) } upgrade ${ shellEscape ( target ) } ` ] , distro ) ,
335+ wslArgs ( [ "bash" , "-lc" , `${ shellEscape ( command ) } upgrade ${ shellEscape ( target ) } ` ] , distro , "root" ) ,
337336 withTimeout ( opts , DEFAULT_WSL_INSTALL_TIMEOUT_MS ) ,
338337 DEFAULT_WSL_INSTALL_TIMEOUT_MS ,
339338 )
0 commit comments