I'm working on a class that I will use for my own debugging purposes. I intend it to be an on device version of the debugger console. Mostly I care about capturing NSLog() statements.
No matter what I log to the console, I'm only getting 0xFF from fgetc(). What I expect to see from fgetc() is a character that was sent to stderr since ...
For desktop apps, it's useful to see the stacktrace on the GUI when the program crashes. I implemented this in Java by replacing System.err with my own error handler, which redirects all error messages to a GUI component and a text file.
The problem: Quite a few libraries out there (e.g. Apache POI) don't just write to System.err when a...
I have a bat script which at one point redirects the stderr of a process to the stdout, and then writes it to a file. I used to do it like this:
process.exe 2>&1 > file.txt
However, this doesn't redirect the stderr to the file ( for reasons I can't understand ). When I modified the line to :
process.exe > file.txt 2>&1
The whole t...
When printing the "usage" of an application, should it be done on stdout or on stderr?
Depending on the application I've seen several cases, but there doesn't seem to be one rule. Maybe I'm mistaken and there is one good practice. In that case, what is it?
...
I'm trying to check for an SVN tag existence from a Perl script. So I try calling svn info $url, read exit code and suppress standard output and standard error streams. However, I struggle to do this elegantly (there are probably better ways to ask SVN about a tag, but that's not the point here):
my $output = `svn info $url/tags/$tag`;
...
Hello folks,
One of the binaries which I am using in my shell script is causing a segmentation fault (RETURN VALUE: 139)
And even though, I am redirecting both stdout and stderr to a logfile, the Segmentation Fault error messages is displayed in the terminal when I am running the shell script.
Is it possible to redirect this message ...
I have a problem that writes information to stdout and stderr, and I need to grep through what's coming to stderr, while disregarding stdout.
I can of course do it in 2 steps:
command > /dev/null 2> temp.file
grep 'something' temp.file
but I would prefer to be able to do is without temp files. Any smart piping trick?
...
I've got a script that calls out to a bunch of commands, some of which are noisy to stdout, some to stderr, some to both. I intend the script to be run by cron, so I don't want it to be noisy and mail me every day -- only in error conditions. So I do:
be_quiet() {
# save stderr in FD 3
exec 3>&2
exec &> /dev/null
}
die() {
...
To redirect (and append) stdout and stderr to a file, while also displaying it on the terminal I do this:
command 2>&1 | tee -a file.txt
However, is there another way to do this such that I get an accurate value for the exit status?
That is if I test $?, I want to see the exit status of 'command' and not the exit status of tee.
I kn...
I am writing a bash script and need to redirect the stdout and stderr output of a command i run to a single file, prefixing each line with stderr or stdout, accordingly.
is there a simple way to do this?
...
I'm new to Perl and want to know of a way to run an external command (call it prg) in the following scenarios:
Run prg, get its stdout only.
Run prg, get its stderr only.
Run prg, get its stdout and stderr, separately.
...
I want to do something like this
ffmpeg -i audio.mp3 -f flac - | oggenc2.exe - -o audio.ogg
i know how to do ffmpeg -i audio.mp3 -f flac using the process class in .NET but how do i pipe it to oggenc2?
Any example of how to do this (it doesnt need to be ffmpeg or oggenc2) would be fine.
...
Is there a good cheat sheet demonstrating the many uses of BASH shell redirection? I would love to give such a thing to my students. Some examples I'd like to see covered:
cmd > output_file.txt #redirect stdout to output_file.txt
cmd 2> output_file.txt #redirect stderr to output_file.txt
cmd >& outpout_file.txt #redirec...
I'm just starting on Python and maybe I'm worrying too much too soon, but anyways...
log = "/tmp/trefnoc.log"
def logThis (text, display=""):
msg = str(now.strftime("%Y-%m-%d %H:%M")) + " TREfNOC: " + text
if display != None:
print msg + display
logfile = open(log, "a")
logfile.write(msg + "\n")
logfile.clos...
I have been trying to capture stdout and stderr output from a DLL compiled in MSVC++ that my Delphi app statically links to, but so far have been unsuccessful.
procedure Test;
var
fs: TFileStream;
begin
fs := TFileStream.Create('C:\temp\output.log', fmCreate or fmShareDenyWrite);
SetStdHandle(STD_OUTPUT_HANDLE, fs.Handle);
SetS...
I'm running java with the -verbose:gc option to measure garbage collector behavior, but it sends the info to stdout, mixing with my program's normal output. How do I tell it to output this info to stderr?
...
Hello,
I am using nosetests to test several scripts. But when I run nosetests it prints out the logging. I know it stores logging info into sys.stderr. Does anyone know how to stop this from outputting to the screen?
I just want the test results to output like when you run unittest normally.
Thanks for any help
...
i working on a c++ string library that have main 4 classes that deals with ASCII, UTF8, UTF16, UTF32 strings, every class has Print function that format an input string and print the result to stdout or stderr. my problem is i don't know what is the default character encoding for those streams.
for now my classes work in windows, later ...
I am trying to isolate a nasty bug, which brings down my linux kernel. I am printing messages to stderr and stderr is redirected to a log file. Is there a way to disable buffering on the file access? When kernel hangs, I am losing the messages in the buffer.
...
I'm looking for a Python solution that will allow me to save the output of a command in a file without hiding it from the console.
FYI: I'm asking about tee (as the Unix command line utility) and not the function with the same name from Python intertools module.
Details
Python solution (not calling tee, it is not available under Wind...