From 4f08a33de826c4196db3115faeed6a3ec67073de Mon Sep 17 00:00:00 2001 From: spiritlhl <103393591+spiritLHLS@users.noreply.github.com> Date: Tue, 15 Jul 2025 10:58:40 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=A6=BB=E7=BA=BF=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E4=B8=8B=E4=B8=8D=E5=86=8D=E5=B0=9D=E8=AF=95=E7=BB=93=E6=9E=9C?= =?UTF-8?q?=E5=88=86=E4=BA=AB=E9=93=BE=E6=8E=A5=E7=9A=84=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- goecs.go | 69 +++++++++++++++++++++++++++++++++----------------------- 1 file changed, 41 insertions(+), 28 deletions(-) diff --git a/goecs.go b/goecs.go index ec9e079..458b123 100644 --- a/goecs.go +++ b/goecs.go @@ -414,40 +414,48 @@ func handleSignalInterrupt(sig chan os.Signal, startTime *time.Time, output *str httpURL string httpsURL string }, 1) - go func() { - httpURL, httpsURL := utils.ProcessAndUpload(finalOutput, filePath, enabelUpload) - resultChan <- struct { - httpURL string - httpsURL string - }{httpURL, httpsURL} - uploadDone <- true - }() - select { - case result := <-resultChan: - if result.httpURL != "" || result.httpsURL != "" { - if language == "en" { - fmt.Printf("Upload successfully!\nHttp URL: %s\nHttps URL: %s\n", result.httpURL, result.httpsURL) - } else { - fmt.Printf("上传成功!\nHttp URL: %s\nHttps URL: %s\n", result.httpURL, result.httpsURL) + if enabelUpload { + go func() { + httpURL, httpsURL := utils.ProcessAndUpload(finalOutput, filePath, enabelUpload) + resultChan <- struct { + httpURL string + httpsURL string + }{httpURL, httpsURL} + uploadDone <- true + }() + select { + case result := <-resultChan: + if result.httpURL != "" || result.httpsURL != "" { + if language == "en" { + fmt.Printf("Upload successfully!\nHttp URL: %s\nHttps URL: %s\n", result.httpURL, result.httpsURL) + } else { + fmt.Printf("上传成功!\nHttp URL: %s\nHttps URL: %s\n", result.httpURL, result.httpsURL) + } } + time.Sleep(100 * time.Millisecond) + if runtime.GOOS == "windows" || runtime.GOOS == "darwin" { + fmt.Println("Press Enter to exit...") + fmt.Scanln() + } + os.Exit(0) + case <-time.After(30 * time.Second): + if language == "en" { + fmt.Println("Upload timeout, program exit") + } else { + fmt.Println("上传超时,程序退出") + } + if runtime.GOOS == "windows" || runtime.GOOS == "darwin" { + fmt.Println("Press Enter to exit...") + fmt.Scanln() + } + os.Exit(1) } - time.Sleep(100 * time.Millisecond) + } else { if runtime.GOOS == "windows" || runtime.GOOS == "darwin" { fmt.Println("Press Enter to exit...") fmt.Scanln() } os.Exit(0) - case <-time.After(30 * time.Second): - if language == "en" { - fmt.Println("Upload timeout, program exit") - } else { - fmt.Println("上传超时,程序退出") - } - if runtime.GOOS == "windows" || runtime.GOOS == "darwin" { - fmt.Println("Press Enter to exit...") - fmt.Scanln() - } - os.Exit(1) } } os.Exit(0) @@ -768,6 +776,9 @@ func main() { handleMenuMode(preCheck) } handleLanguageSpecificSettings() + if !preCheck.Connected { + enabelUpload = false + } var ( wg1, wg2, wg3 sync.WaitGroup basicInfo, securityInfo, emailInfo, mediaInfo, ptInfo string @@ -787,7 +798,9 @@ func main() { default: fmt.Println("Unsupported language") } - handleUploadResults(output) + if preCheck.Connected { + handleUploadResults(output) + } finish = true if runtime.GOOS == "windows" || runtime.GOOS == "darwin" { fmt.Println("Press Enter to exit...")