Revision: 76825
http://sourceforge.net/p/brlcad/code/76825
Author: starseeker
Date: 2020-08-18 11:56:49 +0000 (Tue, 18 Aug 2020)
Log Message:
-----------
When we're in command execution mode, clear out all the Tcl events (if any)
from subprocesses *before* we exit, in order to print their output.
Modified Paths:
--------------
brlcad/trunk/src/mged/mged.c
Modified: brlcad/trunk/src/mged/mged.c
===================================================================
--- brlcad/trunk/src/mged/mged.c 2020-08-18 11:29:43 UTC (rev 76824)
+++ brlcad/trunk/src/mged/mged.c 2020-08-18 11:56:49 UTC (rev 76825)
@@ -1556,11 +1556,6 @@
/* If this is an argv[] invocation, do it now */
if (argc > 1) {
- const char *av[2];
-
- av[0] = "q";
- av[1] = NULL;
-
/* Call cmdline instead of calling mged_cmd directly so that
* access to Tcl/Tk is possible.
*/
@@ -1570,6 +1565,21 @@
cmdline(&input_str, TRUE);
bu_vls_free(&input_str);
+ // If we launched subcommands, we need to process their
+ // output before quitting. Do one up front to catch
+ // anything produced by a process that already exited,
+ // loop while libged still reports running processes,
+ // and then a final call before quitting to get the
+ // last output from the last command.
+ Tcl_DoOneEvent(TCL_ALL_EVENTS|TCL_DONT_WAIT);
+ while (BU_PTBL_LEN(&GEDP->ged_subp)) {
+ Tcl_DoOneEvent(TCL_ALL_EVENTS|TCL_DONT_WAIT);
+ }
+ Tcl_DoOneEvent(TCL_ALL_EVENTS|TCL_DONT_WAIT);
+
+ const char *av[2];
+ av[0] = "q";
+ av[1] = NULL;
f_quit((ClientData)NULL, INTERP, 1, av);
/* NOTREACHED */
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits