Skip to content

Commit afca31b

Browse files
committed
handle clean_env for remotetunnel
1 parent a417cd8 commit afca31b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

koboldcpp.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6084,8 +6084,17 @@ def run_tunnel():
60846084
else:
60856085
print("Starting Cloudflare Tunnel for Linux, please wait...", flush=True)
60866086
tunnelbinary = "./cloudflared-linux-amd64"
6087-
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)
6087+
6088+
tunnelproc = None
6089+
if sys.platform == "linux":
6090+
clean_env = os.environ.copy()
6091+
clean_env.pop("LD_LIBRARY_PATH", None)
6092+
clean_env["PATH"] = "/usr/bin:/bin"
6093+
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)
6094+
else:
6095+
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)
60886096
time.sleep(10)
6097+
60896098
def tunnel_reader():
60906099
nonlocal tunnelproc,tunneloutput,tunnelrawlog
60916100
pattern = r'https://[\w\.-]+\.trycloudflare\.com'

0 commit comments

Comments
 (0)