From afca31bfbef9b0644d29db3601fff3c546d6c78a Mon Sep 17 00:00:00 2001 From: Concedo <39025047+LostRuins@users.noreply.github.com> Date: Thu, 17 Jul 2025 18:21:22 +0800 Subject: [PATCH] handle clean_env for remotetunnel --- koboldcpp.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/koboldcpp.py b/koboldcpp.py index 1a5328b1c..aab86351c 100644 --- a/koboldcpp.py +++ b/koboldcpp.py @@ -6084,8 +6084,17 @@ def setuptunnel(global_memory, has_sd): else: print("Starting Cloudflare Tunnel for Linux, please wait...", flush=True) tunnelbinary = "./cloudflared-linux-amd64" - tunnelproc = subprocess.Popen(f"{tunnelbinary} tunnel --url {httpsaffix}://localhost:{int(args.port)}{ssladd}", text=True, encoding='utf-8', shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE) + + tunnelproc = None + if sys.platform == "linux": + clean_env = os.environ.copy() + clean_env.pop("LD_LIBRARY_PATH", None) + clean_env["PATH"] = "/usr/bin:/bin" + tunnelproc = subprocess.Popen(f"{tunnelbinary} tunnel --url {httpsaffix}://localhost:{int(args.port)}{ssladd}", text=True, encoding='utf-8', shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE, env=clean_env) + else: + tunnelproc = subprocess.Popen(f"{tunnelbinary} tunnel --url {httpsaffix}://localhost:{int(args.port)}{ssladd}", text=True, encoding='utf-8', shell=True, stdout=subprocess.DEVNULL, stderr=subprocess.PIPE) time.sleep(10) + def tunnel_reader(): nonlocal tunnelproc,tunneloutput,tunnelrawlog pattern = r'https://[\w\.-]+\.trycloudflare\.com'