With the application Utilities/Console.app, I can see the console output of applications.
Is there a way to access this log from another application?
To be more specific: I am writing a crashhandler for my application and I want that it attaches the console output to the crash information.
...
I'm interested in two situations:
How to do it from C++?
How to do it from system's shell?
Answers for Linux, Windows and OSX are welcome.
...
I have a server application that writes to a popen("myCommand", "w") file descriptor in a separate thread and if the command passed to popen() results in any output to stdout or stderr, the my application exits. However, this is only an issue when my server application was invoked via inetd, if I used ssh to launch the server, it does n...
I have read tons of posts but still can't seem to figure it out.
I want to subprocess.Popen() rsync.exe in windows, and print the stdout in python.
My code works, but it doesn't catch the progress until a file is done transfered! I want to print the progress for each file in realtime.
Using python 3.1 now since I heard it should be be...
I'm using a simple QProcess-Project on a WindowsXP-Machine:
QString program = "U:\\ffmpeg.exe";
QStringList arguments;
arguments << "-i" << "U:\\clock.avi" << "U:\\tmp_jpeg\\foo-%03d.jpeg";
process.setStandardOutputFile("U:\\log.txt", QIODevice::Append);
process.start(program, arguments);
The Process works just fine, ffmpeg creates a...
I wonder if it is possible to shut down the communication pipe when killing a subprocess started in a different thread. If I do not call communicate() then kill() will work as expected, terminating the process after one second instead of five.
I found a discussion of a similar problem here, but I got no real answers. I assume that I eit...
If I have a windows console program written with c++, is it possible to retrieve that program's standard output, while the program is running? And if not, what would be the best way to rewrite the program? I know I could output to files and continuously check those files for updates. Is there another way? Is there a better way?
...
I have a POE Perl program forking children.
The children it is forking do logging and interactive telnets into remote devices.
POE uses STDOUT to return output back up to the parent process but for some reason it's getting lost (not going to screen or to any files).
I'm theorising that this is because STDOUT is being redirected somewhe...
To temporarily redirect stdout to a file, I'm doing:
printf("Before");
freopen_s(&stream, "test.txt", "w", stdout);
printf("During");
freopen_s(&stream, "CONOUT$", "w", stdout);
printf("After");
That works, however doing:
CONSOLE_SCREEN_BUFFER_INFO sbi = {0};
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &sbi);
No lon...
Hi,
I am triggering an ant script (via cruise control), and would like to be able to dump the std out and std err for a particular ant target to a plain text file.
Yes, I am aware that cruise control already does maintain an XML log file containing this information (among many other things), but for portability reasons, I need this to ...
I try to log all the output of a program written in Python and C. However, printing from Python causes IOError: [Errno 9] Bad file descriptor
Please, does anyone know what the problem is and how to fix it?
PS: It's on Windows XP, Python 2.6 and MinGW GCC
#include <windows.h>
#include <fcntl.h>
#include "Python.h"
int main()
{
int...
I'm looking for a way in C to programmatically (ie, not using redirection from the command line) implement 'tee' functionality such that my stdout goes to both stdout and a log file. This needs to work for both my code and all linked libraries that output to stdout. Any way to do this?
...
I have a small C program to calculate hashes (for hash tables). The code looks quite clean I hope, but there's something unrelated to it that's bugging me.
I can easily generate about one million hashes in about 0.2-0.3 seconds (benchmarked with /usr/bin/time). However, when I'm printf()inging them in the for loop, the program slows dow...
For example, the prxml function prints XML to *out*. I would like to instead capture this output as a String. Here is the typical usage from a REPL:
user> (prxml [:p "Test"])
<p>Test</p>nil
I'd instead like to do:
(def xml (capture-out (prxml [:p "Test"])))
I made up the capture-out function, but I suspect something like it exists,...
I'm using Python (and the Win32 extensions) to execute macros in an Excel spreadsheet via the COM interface, as shown below:
import win32com.client
o = win32com.client.Dispatch("Excel.Application")
o.Visible = 1
o.Workbooks.Open (r"C:\test.xls")
o.Application.Run("macro1")
What I'd like to do is have the Excel macro output text warnin...
I have an interactive program that runs stdin and stdout.
I need to create wrapper that will send X to it's stdin, check that it prints Y and then
redirects wrapper's stdin and stdout to program's stdin and stdout just like program would be executed directly.
How to implement this ? X and Y can be hardcoded. Bash? Python?
Edit: I can't...
I have a cross-platform Perl program that starts a win32 windows program on win, and a macosx appliaction on the mac.
I use system(), which on the mac makes the stdout of the invoked program, be written in the stdout of the Perl program, which is what i want.
On Windows, it seems like there is no way to get the stdout a Windows program...
#include <stdio.h>
int main() {
printf("This goes to screen\n");
freopen("out.txt", "a", stdout);
printf("This goes to out.txt");
freopen("/dev/stdout", "a", stdout);
printf("This should go to screen too, but doesn't\n");
return 0;
}
I call freopen to redirect the stdout to out.txt then I print something on th...
I'm very new to programming so I apologize in advance if my question is too silly.
#!/usr/bin/python2.6
import subprocess, time
p=subprocess.Popen(['cat'], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
for i in 'abcd':
p.stdin.write(str.encode(i+'\n'))
output=p.stdout.readline()
print(output)
time.sleep(1...
I am running array jobs with Sun Grid Engine (SGE).
My carefully scripted array job workers generate no stdout and no stderr when they function properly. Unfortunately, SGE insists on creating an empty stdout and stderr file for each run.
Sun's manual states:
STDOUT and STDERR of array job tasks will be written into ...