[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#994848: xterm: "xterm -e command" should return the exit code of "command"



Hi Sven,

Sven Joachim wrote:
> > for test suites of tools which manipulate terminals, it would be nice if
> > "xterm -e command" would return the exit code of "command", e.g.
> >
> >   $ xterm -e false
> >
> > should exit with return code 1, but actually does exit with return code 0.
> 
> That would certainly be useful for automatic tests, but seems to clash
> with xterm's current use of error return codes when it itself encounters
> a fatal problem.

Indeed. Maybe a new option is then the better way to go here. My
suggestion would be "-E" similar how Perl' -e and -E work. They do the
same, but -E does more.

> All the terminal emulators on my system behave the same way as xterm and
> happily exit 0, even when the command specified in the -e option cannot
> be found.

For my current use case I used the following workaround to transport
output and exit code:

  override_dh_auto_test:
        xvfb-run xterm -e '( dh_auto_test ; echo $$? ) | tee debian/xterm_dh_auto_test.log'
	cat debian/xterm_dh_auto_test.log
	sh -c 'exit $$(tail -1 debian/xterm_dh_auto_test.log)'

Quite hackish, but seems to work so far. (Double dollar sign due to
being Makefile syntax.)

Only downside so far: I can't capture STDERR because as soon as I add
"2>&1", xtermcontrol argues it can't find the controlling terminal
anymore. But that might be an xtermcontrol issue.

		Regards, Axel
-- 
 ,''`.  |  Axel Beckert <abe@debian.org>, https://people.debian.org/~abe/
: :' :  |  Debian Developer, ftp.ch.debian.org Admin
`. `'   |  4096R: 2517 B724 C5F6 CA99 5329  6E61 2FF9 CD59 6126 16B5
  `-    |  1024D: F067 EA27 26B9 C3FC 1486  202E C09E 1D89 9593 0EDE


Reply to: