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 = ''