[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] Capturing crash using stderr redirection
From: |
Bob Proulx |
Subject: |
Re: [Help-bash] Capturing crash using stderr redirection |
Date: |
Tue, 14 Feb 2012 17:44:54 -0700 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
suvayu ali wrote:
> I am trying to run a job on an SL 5.7 node which is crashing (some
> malloc problem). So I wanted to capture the crash by redirecting
> stderr to my log file like this:
>
> $ job_command <args> &> log &
>
> But everything except the crash is recorded in log. Without any
> redirection, I see the crash on my terminal. Right now I have worked
> around it by using the logging feature in screen. This is with bash
> 3.2.25(1)-release. Does anyone know what could be the problem?
Normally libc buffers output when it is sent to a file but not when it
is sent to a tty. When redirected to a file it won't be a tty and
will be buffered. If the program crashes unexpectedly and without
flushing buffers then data might be lost in one case but not the other
case.
Here is a reference you might find useful:
http://www.pixelbeat.org/programming/stdio_buffering/
Then you might try one of the techniques detailed there to cause the
output to be unbuffered.
Bob