Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > gnu.bash.bug > #11227

time builtin does not work with set -e when a command fails

From Sam Watkins <sam@nipl.net>
Newsgroups gnu.bash.bug
Subject time builtin does not work with set -e when a command fails
Date 2015-07-17 13:48 +1000
Message-ID <mailman.7048.1437136393.904.bug-bash@gnu.org> (permalink)

Show all headers | View raw


Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H   -I.  -I../bash -I../bash/include -I../bash/lib  -D_FORTIFY_SOURCE=2 -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall
uname output: Linux opal.nipl.net 3.2.0-4-amd64 #1 SMP Debian 3.2.65-1+deb7u2 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu

Bash Version: 4.2
Patch Level: 37
Release Status: release

Description:
	The time builtin does not work with set -e when a command fails.
	The "time" builtin should give timing for a command regardless of exit status.

	Examples:

	# 1. with set -e, the time builtin is silent for failed commands (this is the bug)
	$ bash -ce 'time false'

	# 2. normally the time builtin gives times for failed commands
	$ bash -c 'time false'

	real    0m0.000s
	user    0m0.000s
	sys     0m0.000s

	# 3. the time(1) utility gives times for failed commands with set -e, of course
	$ bash -ce 'command time false'
	Command exited with non-zero status 1
	0.00user 0.00system 0:00.00elapsed 0%CPU (0avgtext+0avgdata 1664maxresident)k
	0inputs+0outputs (0major+150minor)pagefaults 0swaps

Repeat-By:
	$ bash -ce 'time false'

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

time builtin does not work with set -e when a command fails Sam Watkins <sam@nipl.net> - 2015-07-17 13:48 +1000

csiph-web