From cc34f33d9238eb40d471ef14ae4c7a54ffc82114 Mon Sep 17 00:00:00 2001 From: Jojojoppe Date: Fri, 21 Feb 2025 14:54:20 +0100 Subject: [PATCH] Fixed issues --- remotesyn/rbuild.py | 9 +++++++-- remotesyn/rmserver.py | 4 ++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/remotesyn/rbuild.py b/remotesyn/rbuild.py index 2e88983..d4b9dd1 100755 --- a/remotesyn/rbuild.py +++ b/remotesyn/rbuild.py @@ -73,12 +73,17 @@ def main(): exit(1) try: - exec(f"from remotesyn.toolchains.{toolchain} import do") + print(f'Importing toolchain {toolchain}') + namespace = {} + exec(f"from remotesyn.toolchains.{toolchain} import do", globals(), namespace) + do_func = namespace.get('do') + if do_func is None: + raise ImportError("Failed to import 'do'") except ImportError: log(f"ERROR: Unknown toolchain '{toolchain}'") exit(1) - ret = do(config, target, log, subprocesses) + ret = do_func(config, target, log, subprocesses) if ret!=0: log("ERROR: toolchain returned with", ret) diff --git a/remotesyn/rmserver.py b/remotesyn/rmserver.py index 8a04774..fccfb5b 100644 --- a/remotesyn/rmserver.py +++ b/remotesyn/rmserver.py @@ -15,6 +15,7 @@ import threading import socket import shutil import fcntl +import traceback # List of running threads threads = [] @@ -209,6 +210,7 @@ class SSHServer(paramiko.ServerInterface): global running if running: print("ERROR: Unknown error:", e) + traceback.print_exception(type(e), e, e.__traceback__) return False class Connection(threading.Thread): @@ -258,6 +260,8 @@ def print_help(): print(" -h Show this help message") def main(): + global running + # Parse arguments i = 1 host = ''