diff --git a/CHANGES.txt b/CHANGES.txt index dba65ef6ce..dbb086990a 100755 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -80,6 +80,7 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER - Added user configurable setting of ninja depfile format via NINJA_DEPFILE_PARSE_FORMAT. Now setting NINJA_DEPFILE_PARSE_FORMAT to [msvc,gcc,clang] can force the ninja expected format. Compiler tools will also configure the variable automatically. + - Updated ninja scons daemon scripts to output errors to stderr as well as the daemon log. From Mats Wichmann: - Tweak the way default site_scons paths on Windows are expressed to diff --git a/RELEASE.txt b/RELEASE.txt index 05f4f0df05..817b58b0f4 100755 --- a/RELEASE.txt +++ b/RELEASE.txt @@ -104,6 +104,7 @@ IMPROVEMENTS and msvc batch file determination when configuring the build environment. Simplify the msvc code by eliminating special case handling primarily due to the differences between the full versions and express versions of visual studio. +- Updated ninja scons daemon scripts to output errors to stderr as well as the daemon log. PACKAGING --------- diff --git a/SCons/Tool/ninja/ninja_daemon_build.py b/SCons/Tool/ninja/ninja_daemon_build.py index f34935bd1a..80aa74175a 100644 --- a/SCons/Tool/ninja/ninja_daemon_build.py +++ b/SCons/Tool/ninja/ninja_daemon_build.py @@ -53,6 +53,10 @@ level=logging.DEBUG, ) +def log_error(msg): + logging.debug(msg) + sys.stderr.write(msg) + while True: try: logging.debug(f"Sending request: {sys.argv[3]}") @@ -68,19 +72,19 @@ except (http.client.RemoteDisconnected, http.client.ResponseNotReady): time.sleep(0.01) except http.client.HTTPException: - logging.debug(f"Error: {traceback.format_exc()}") + log_error(f"Error: {traceback.format_exc()}") exit(1) else: msg = response.read() status = response.status if status != 200: - print(msg.decode("utf-8")) + log_error(msg.decode("utf-8")) exit(1) logging.debug(f"Request Done: {sys.argv[3]}") exit(0) except Exception: - logging.debug(f"Failed to send command: {traceback.format_exc()}") + log_error(f"Failed to send command: {traceback.format_exc()}") exit(1) diff --git a/SCons/Tool/ninja/ninja_run_daemon.py b/SCons/Tool/ninja/ninja_run_daemon.py index e78b5494f7..f52585700a 100644 --- a/SCons/Tool/ninja/ninja_run_daemon.py +++ b/SCons/Tool/ninja/ninja_run_daemon.py @@ -60,6 +60,10 @@ level=logging.DEBUG, ) +def log_error(msg): + logging.debug(msg) + sys.stderr.write(msg) + if not os.path.exists(ninja_builddir / "scons_daemon_dirty"): cmd = [ sys.executable, @@ -107,14 +111,13 @@ except (http.client.RemoteDisconnected, http.client.ResponseNotReady): time.sleep(0.01) except http.client.HTTPException: - logging.debug(f"Error: {traceback.format_exc()}") - sys.stderr.write(error_msg) + log_error(f"Error: {traceback.format_exc()}") exit(1) else: msg = response.read() status = response.status if status != 200: - print(msg.decode("utf-8")) + log_error(msg.decode("utf-8")) exit(1) logging.debug("Server Responded it was ready!") break @@ -123,15 +126,13 @@ logging.debug(f"Server not ready, server PID: {p.pid}") time.sleep(1) if p.poll is not None: - logging.debug(f"Server process died, aborting: {p.returncode}") + log_error(f"Server process died, aborting: {p.returncode}") sys.exit(p.returncode) except ConnectionResetError: - logging.debug("Server ConnectionResetError") - sys.stderr.write(error_msg) + log_error("Server ConnectionResetError") exit(1) except Exception: - logging.debug(f"Error: {traceback.format_exc()}") - sys.stderr.write(error_msg) + log_error(f"Error: {traceback.format_exc()}") exit(1) # Local Variables: