[GRASS5] Re: [bug #3709] (grass) d.m - commands output pollutes the Grass terminal

Glynn Clements glynn at gclements.plus.com
Fri Oct 21 09:54:05 EDT 2005


Glynn Clements wrote:

> > If you think it is better then to reopen this bug number for a different
> > issue, I guess that is your call. It just seemed to me that we solved the
> > first issue. Now that it's solved, another issue has become apparent. This
> > is often the case. I just want to make sure that the appropriate people take
> > a look at this. It's not d.m per se, but any commands (or possibly d.rast).
> > You'd get the same result if you did this from the command line.
> 
> Yes, but if the commands are invoked by d.m, d.m should arguably be
> redirecting stdout and stderr to its internal log window.

To elaborate, the issue appears to be that run_panel is redirecting
the program's stdout/stderr to d.m's stdout/stderr rather than
consuming them itself or discarding them.

proc run_panel {cmd} {
	global outtext

	eval exec -- $cmd >@ stdout 2>@ stderr
	set str $cmd
	$outtext insert end "$cmd\n"
	$outtext yview end

	update idletasks
}

The same issue appears to apply to the run procedure.

Both should ideally be behaving like run_cmd from gui.tcl, i.e. using
open rather than exec, and using prnout (or an equivalent) to consume
the output.

Alternatively, a quick fix would be to redirect to /dev/null instead
of stdout/stderr.

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list