From b6e67f834c8cae6c91a33e13ded0c4936534c3df Mon Sep 17 00:00:00 2001 From: dmiller Date: Tue, 28 May 2024 19:30:06 +0000 Subject: [PATCH] Fix #2854: crash if Ndiff exits with error status --- zenmap/zenmapCore/Diff.py | 2 +- zenmap/zenmapGUI/DiffCompare.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/zenmap/zenmapCore/Diff.py b/zenmap/zenmapCore/Diff.py index 0cb49b123..c98716a3c 100644 --- a/zenmap/zenmapCore/Diff.py +++ b/zenmap/zenmapCore/Diff.py @@ -133,7 +133,7 @@ class NdiffCommand(subprocess.Popen): command_list, universal_newlines=True, stdout=self.stdout_file, - stderr=self.stdout_file, + stderr=subprocess.PIPE, env=env, shell=(sys.platform == "win32") ) diff --git a/zenmap/zenmapGUI/DiffCompare.py b/zenmap/zenmapGUI/DiffCompare.py index 12f84dcbd..446050282 100644 --- a/zenmap/zenmapGUI/DiffCompare.py +++ b/zenmap/zenmapGUI/DiffCompare.py @@ -377,9 +377,10 @@ class DiffWindow(Gtk.Window): error_text = _( "The ndiff process terminated with status code %d." ) % status - stderr = self.ndiff_process.stderr.read() - if len(stderr) > 0: - error_text += "\n\n" + stderr + if self.ndiff_process.stderr: + stderr = self.ndiff_process.stderr.read() + if len(stderr) > 0: + error_text += "\n\n" + stderr alert = HIGAlertDialog( message_format=_("Error running ndiff"), secondary_text=error_text)