@@ -95,7 +95,7 @@ func provisionWSLDist(name string, imagePath string, prompt string) (string, err
95
95
96
96
dist := env .WithPodmanPrefix (name )
97
97
fmt .Println (prompt )
98
- if err = runCmdPassThrough (wutil . FindWSL () , "--import" , dist , distTarget , imagePath , "--version" , "2" ); err != nil {
98
+ if err = runCmdPassThrough ("wsl" , "--import" , dist , distTarget , imagePath , "--version" , "2" ); err != nil {
99
99
return "" , fmt .Errorf ("the WSL import of guest OS failed: %w" , err )
100
100
}
101
101
@@ -427,7 +427,7 @@ func installWslKernel() error {
427
427
428
428
backoff := 500 * time .Millisecond
429
429
for i := 0 ; i < 5 ; i ++ {
430
- err = runCmdPassThroughTee (log , wutil . FindWSL () , "--update" )
430
+ err = runCmdPassThroughTee (log , "wsl" , "--update" )
431
431
if err == nil {
432
432
break
433
433
}
@@ -537,18 +537,18 @@ func withUser(s string, user string) string {
537
537
func wslInvoke (dist string , arg ... string ) error {
538
538
newArgs := []string {"-u" , "root" , "-d" , dist }
539
539
newArgs = append (newArgs , arg ... )
540
- return runCmdPassThrough (wutil . FindWSL () , newArgs ... )
540
+ return runCmdPassThrough ("wsl" , newArgs ... )
541
541
}
542
542
543
543
func wslPipe (input string , dist string , arg ... string ) error {
544
544
newArgs := []string {"-u" , "root" , "-d" , dist }
545
545
newArgs = append (newArgs , arg ... )
546
- return pipeCmdPassThrough (wutil . FindWSL () , input , newArgs ... )
546
+ return pipeCmdPassThrough ("wsl" , input , newArgs ... )
547
547
}
548
548
549
549
//nolint:unused
550
550
func wslCreateKeys (identityPath string , dist string ) (string , error ) {
551
- return machine .CreateSSHKeysPrefix (identityPath , true , true , wutil . FindWSL () , "-u" , "root" , "-d" , dist )
551
+ return machine .CreateSSHKeysPrefix (identityPath , true , true , "wsl" , "-u" , "root" , "-d" , dist )
552
552
}
553
553
554
554
func runCmdPassThrough (name string , arg ... string ) error {
@@ -645,7 +645,7 @@ func getAllWSLDistros(running bool) (map[string]struct{}, error) {
645
645
if running {
646
646
args = append (args , "--running" )
647
647
}
648
- cmd := exec .Command (wutil . FindWSL () , args ... )
648
+ cmd := exec .Command ("wsl" , args ... )
649
649
out , err := cmd .StdoutPipe ()
650
650
if err != nil {
651
651
return nil , err
@@ -674,7 +674,7 @@ func getAllWSLDistros(running bool) (map[string]struct{}, error) {
674
674
}
675
675
676
676
func isSystemdRunning (dist string ) (bool , error ) {
677
- cmd := exec .Command (wutil . FindWSL () , "-u" , "root" , "-d" , dist , "sh" )
677
+ cmd := exec .Command ("wsl" , "-u" , "root" , "-d" , dist , "sh" )
678
678
cmd .Stdin = strings .NewReader (sysdpid + "\n echo $SYSDPID\n " )
679
679
out , err := cmd .StdoutPipe ()
680
680
if err != nil {
@@ -704,7 +704,7 @@ func isSystemdRunning(dist string) (bool, error) {
704
704
}
705
705
706
706
func terminateDist (dist string ) error {
707
- cmd := exec .Command (wutil . FindWSL () , "--terminate" , dist )
707
+ cmd := exec .Command ("wsl" , "--terminate" , dist )
708
708
out , err := cmd .CombinedOutput ()
709
709
if err != nil {
710
710
return fmt .Errorf ("command %s %v failed: %w (%s)" , cmd .Path , cmd .Args , err , strings .TrimSpace (string (out )))
@@ -713,7 +713,7 @@ func terminateDist(dist string) error {
713
713
}
714
714
715
715
func unregisterDist (dist string ) error {
716
- cmd := exec .Command (wutil . FindWSL () , "--unregister" , dist )
716
+ cmd := exec .Command ("wsl" , "--unregister" , dist )
717
717
out , err := cmd .CombinedOutput ()
718
718
if err != nil {
719
719
return fmt .Errorf ("command %s %v failed: %w (%s)" , cmd .Path , cmd .Args , err , strings .TrimSpace (string (out )))
@@ -761,7 +761,7 @@ func getCPUs(name string) (uint64, error) {
761
761
if run , _ := isWSLRunning (dist ); ! run {
762
762
return 0 , nil
763
763
}
764
- cmd := exec .Command (wutil . FindWSL () , "-u" , "root" , "-d" , dist , "nproc" )
764
+ cmd := exec .Command ("wsl" , "-u" , "root" , "-d" , dist , "nproc" )
765
765
out , err := cmd .StdoutPipe ()
766
766
if err != nil {
767
767
return 0 , err
@@ -791,7 +791,7 @@ func getMem(name string) (strongunits.MiB, error) {
791
791
if run , _ := isWSLRunning (dist ); ! run {
792
792
return 0 , nil
793
793
}
794
- cmd := exec .Command (wutil . FindWSL () , "-u" , "root" , "-d" , dist , "cat" , "/proc/meminfo" )
794
+ cmd := exec .Command ("wsl" , "-u" , "root" , "-d" , dist , "cat" , "/proc/meminfo" )
795
795
out , err := cmd .StdoutPipe ()
796
796
if err != nil {
797
797
return 0 , err
0 commit comments