[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-time] GNU time
From: |
Assaf Gordon |
Subject: |
Re: [Bug-time] GNU time |
Date: |
Wed, 16 Oct 2019 23:11:03 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 |
Hello,
On 2019-10-15 12:22 p.m., Сергей Кузнецов wrote:
Hello,
What about adding in GNU time 4 new qualifiers?
%T 1 if program terminated by a signal, empty otherwise
%S signal number of program terminal by a signal, empty otherwise
%X exit code if program terminated normal,
or empty if terminated by a singal.
(Thanks Assaf Gordon)
And fours is
%N signal's name (like SIGSEGV, segv, sigsegv, segmentation fault
etc.), empty otherwise
Hope to feedback from you,
Turns out many single-letter specifiers are already taken.
I've used the following:
---
%Tt = the strings 'normal' or 'signalled' or 'stopped' based on how
the program exited.
%Tx = numeric exit code IF the program exited normally (not signalled).
empty otherwise.
%Tn = numeric signal number IF the program was terminated by a signal.
empty otherwise.
%Ts = signal name IF the program was terminated by a signal.
empty otherwise.
---
Examples:
$ ./time -q \
-f "exit type: %Tt\nexit code: %Tx\nsig-spec:
%Ts\nsig-num:%Tn\n" \
./tests/time-aux -S KILL -e 4
exit type: signalled
exit code:
sig-spec: KILL
sig-num: 9
$ ./time -q \
-f "exit type: %Tt\nexit code: %Tx\nsig-spec: %Ts\nsig-num:
%Tn\n" \
./tests/time-aux -e 4
exit type: normal
exit code: 4
sig-spec:
sig-num:
---
The code is available in a separate branch:
https://git.savannah.gnu.org/cgit/time.git/log/?h=signal-reporting
and here:
https://download-mirror.savannah.gnu.org/releases/time/time-1.9.5-4aa7.tar.gz
---
More testing and feedback is welcomed.
Once this stabilizes I'll add it to the GNU time master branch.
regards,
- assaf