Skip to content

Commit 1723dcc

Browse files
committed
fix: 试图修复bug
1 parent 5bf280a commit 1723dcc

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

core/download.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ func DownloadFile(url, filePath string) error {
5555
if start > 0 {
5656
req.Header.Set("Range", "bytes="+strconv.FormatInt(start, 10)+"-")
5757
}
58-
58+
var gitversion string
59+
req.Header.Set("User-Agent", "AutoInstall"+gitversion)
5960
client := &http.Client{}
6061
resp, err := client.Do(req)
6162

core/installer.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,17 @@ func RunInstaller(installerPath string, loader string, version string, loaderVer
1414
var javaPath string
1515
if simpfun {
1616
if mise {
17+
var cmd *exec.Cmd
1718
if version < "1.17" {
18-
exec.Command("mise use -g java@zulu-8.86.0.25")
19+
cmd = exec.Command("mise", "use", "-g", "java@zulu-8.86.0.25")
1920
} else if version >= "1.17" && version <= "1.20.3" {
20-
exec.Command("mise use -g java@zulu-17.58.21")
21+
cmd = exec.Command("mise", "use", "-g", "java@zulu-17.58.21")
2122
} else {
22-
exec.Command("mise use -g java@zulu-21.42.19")
23+
cmd = exec.Command("mise", "use", "-g", "java@zulu-21.42.19")
24+
}
25+
err := cmd.Run()
26+
if err != nil {
27+
fmt.Println("mise use failed:", err)
2328
}
2429
javaPath = "java"
2530
} else {

0 commit comments

Comments
 (0)