Skip to content

Commit 48d0d19

Browse files
installing eslint in wsl
1 parent f6c5164 commit 48d0d19

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

config/tools-installer.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,24 @@ func installRuntimeTool(name string, toolInfo *plugins.ToolInfo, registry string
107107
// Execute the installation command using the package manager
108108
cmd := exec.Command(packageManagerBinary, strings.Split(installCmd, " ")...)
109109

110+
// Special handling for ESLint installation in WSL environment
111+
if toolInfo.Name == "eslint" {
112+
// Get node binary directory to add to PATH
113+
nodeBinary, ok := runtimeInfo.Binaries["node"]
114+
if ok {
115+
nodeDir := filepath.Dir(nodeBinary)
116+
// Get current PATH
117+
currentPath := os.Getenv("PATH")
118+
// For WSL, always use Linux path separator
119+
pathSeparator := ":"
120+
newPath := nodeDir + pathSeparator + currentPath
121+
cmd.Env = append(os.Environ(), "PATH="+newPath)
122+
log.Printf("Setting PATH environment for ESLint installation: %s\n", nodeDir)
123+
}
124+
}
125+
110126
log.Printf("Installing %s v%s...\n", toolInfo.Name, toolInfo.Version)
127+
log.Printf("Running command: %s %s\n", packageManagerBinary, installCmd)
111128
output, err := cmd.CombinedOutput()
112129
if err != nil {
113130
return fmt.Errorf("failed to install tool: %s: %w", string(output), err)

0 commit comments

Comments
 (0)