Send error message to non-screen output devices also, if routing to
[pspp-builds.git] / src / ui / terminal / msg-ui.c
index b51a3e557021fe26f042ed3e610a4981a315fb3f..93c3683f220f9d084a2e00defb97f23fefff073e 100644 (file)
@@ -26,6 +26,8 @@
 #include <libpspp/message.h>
 #include <libpspp/str.h>
 #include <output/journal.h>
+#include <output/output.h>
+#include <output/table.h>
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -177,6 +179,16 @@ handle_msg (const struct msg *m)
 
   dump_message (ds_cstr (&string), 78, 0, write_journal, NULL);
 
+  if (get_error_routing_to_listing ())
+    {
+      /* Disable screen output devices, because the error should
+         already have been reported to the screen with the
+         dump_message call above. */
+      outp_enable_device (false, OUTP_DEV_SCREEN);
+      tab_output_text (TAB_LEFT, ds_cstr (&string));
+      outp_enable_device (true, OUTP_DEV_SCREEN);
+    }
+
   ds_destroy (&string);
 }