stdout

Where is stdout for a Mac App?

纵然是瞬间 提交于 2019-12-05 22:02:30
问题 It used to be that stdout went to the console log, displayed by Console.app. I've been having some problems with a firefox plugin (see other questions, sorry about the spam...) and I was trying to use printfs to at least see if I was STARTING my plugin. I just noticed today that my console log hasn't been updated since January 6. (Yes, I've been using the machine for the past month.) Now, I'm not the only program that uses the console log, so all those messages must be going SOMEWHERE else.

difference between communicate() and .stdin.write, .stdout.read or .stderr.read - python

余生长醉 提交于 2019-12-05 21:19:05
I wan to create a pipe between 3 commands: cat = subprocess.Popen("cat /etc/passwd", stdout=subprocess.PIPE) grep = subprocess.Popen("grep '<usernamr>'", stdin=cat.stdout, stdout=subprocess.PIPE) cut = subprocess.Popen("cut -f 3 -d ':'", stdin=grep.stdout, stdout=subprocess.PIPE) for line in cut.stdout: # process each line here But python documentation says: Use communicate() rather than .stdin.write , .stdout.read or .stderr.read to avoid deadlocks due to any of the other OS pipe buffers filling up and blocking the child process. then how should I use cut.stdout ? Can someone explain

Java: What's the reason behind System.out.println() being that slow?

回眸只為那壹抹淺笑 提交于 2019-12-05 20:28:30
问题 For small logical programs that can be done in a text editor, for tracing I use the classic System.out.println() . I guess you all know how frustrating it is to use that in a block of high number of iterations. Why is it so slow? What's the reason behind it? 回答1: This has nothing whatsoever to do with the JVM. Printing text to screen simply involves a lot of work for the OS in drawing the letters and especially scrolling. If you redirect System.out to a file, it will be much faster. 回答2: This

How to redirect stdout stderr in an ant script?

微笑、不失礼 提交于 2019-12-05 20:08:00
问题 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 happen from the ant script itself. Is this possible, and if so, how to do it? Many thanks! 回答1: The recorder task may be able to do what you want: <record name=

VBScript - Capturing output from stdout

爷,独闯天下 提交于 2019-12-05 19:55:16
I know this has been answered one in another question, but I simply do not understand how it is done. I am trying to get the output of a command line program (Aria2 downloader) into a HTA script so it can be parsed and the download percentage, file size etc can be obtained and updated into a DIV dynamically. Here is the code I have adjusted and have been trying to use but it just locks up the interface until the command line has finished and THEN displays all the output, instead of displaying it as and when it comes through. Const WshRunning = 0 Const WshFinished = 1 Const WshFailed = 2

Is it possible to get the output of a program while it's running?

被刻印的时光 ゝ 提交于 2019-12-05 18:18:44
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? There are some interesting articles in Code Project: CommandLineHelper (C#) Redirecting an arbitrary Console's Input/Output (MFC/C++) Universal Console Redirector (MFC/C++) Yes, if you start the program yourself: in CreateProcess , you pass a STARTUPINFO where you can

stdin, stdout and stderr are shared between?

非 Y 不嫁゛ 提交于 2019-12-05 17:56:48
I am trying to understand the behavior of the three streams - stdout , stdin and stderr . I couldn't get the answer from any textbook, so I came here. I know that these three are stored in file descriptor table with file descriptors 0 (stdin), 1 (stdout) and 2 (stderr). I am also aware that these are not merely file descriptors but I/O streams which can be redirected. Ok, so how about sharing? Consider the three cases: When a fork() is called : The child process and parent process shares file descriptors, but do they have the same stdin, stdout and stderr ? When a thread is created : Threads

Python - detect when my object is written to stdout?

本秂侑毒 提交于 2019-12-05 17:39:02
问题 I have a rather unusual request, I think... I'll explain the why after I explain the what. What I want to detect whenever my object is written to stdout, so that I can perform side effects at that time. So, for example, when I type: sys.stdout.write(instance_of_my_class) it should perform side effects. I've made my class be a subclass of str and overrode __call__ , __unicode__ , __str__ , __repr__ , index , decode , encode , format , __format__ , __getattribute__ , __getitem__ , and __len__

redirecting stdin/stdout from exec'ed process to pipe in Perl

依然范特西╮ 提交于 2019-12-05 17:36:23
问题 I am trying to have STDOUT/STDERR from a exec'ed child process go back to the parent via a pipe in Perl. The closest I have seen to what I want to do is at : http://forums.devshed.com/perl-programming-6/exec-and-redirecting-stdout-stderr-168501.html The following is a stripped down example of what I am trying to do. I also tried a variant of the link above. I can't see what I'm doing wrong... #!/usr/bin/env perl use strict ; use warnings ; my $cmd = "/usr/bin/who -a" ; # anything to stdout

How can I suppress the line numbers output using R CMD BATCH?

拥有回忆 提交于 2019-12-05 17:20:00
问题 If I have an R script: print("hi") commandArgs() And I run it using: r CMD BATCH --slave --no-timing test.r output.txt The output will contain: [1] "hi" [1] "/Library/Frameworks/R.framework/Resources/bin/exec/x86_64/R" [2] "-f" [3] "test.r" [4] "--restore" [5] "--save" [6] "--no-readline" [7] "--slave" How can i suppress the line numbers[1]..[7] in the output so only the output of the script appears? 回答1: Yes, mbq is right -- use Rscript , or, if it floats your boat, littler: $ cat /tmp/tommy