stdout

How can I write blocking in stdout with node.js?

好久不见. 提交于 2019-12-04 03:40:40
问题 I'm writing a node.js application which stdout is piped to a file. I'm writing everything with console.log. After a while my Application reaches the 1GB Limit and stops. The interesting thing is, that if I use console.error instead of console.log, the memory usage keeps low and the programm runs fine. So it looks like node.js can't flush the stdout stream and everything is kept in memory. I wanna keep stderr free for errors. My Question is: Is there a way to write blocking into stdout? Or at

Mirror console output to file in c++

馋奶兔 提交于 2019-12-04 03:31:42
问题 In C++, is there a smart way to mirror output from stdout to both the console and the file? I'm hoping there is a way to do it like in this question. Edit: It would be nice to be able to do this with just the standard libraries (ie: no boost).. 回答1: Alternatively, just start your program so it's piped to the tee command. 回答2: You could try a Tee Device provided by Boost.Iostreams. A Tee device directs output to multiple streams. As far as I know, you can chain them to reach theoretically

How do you use Log4j to write/capture stdout and stderr to a file and using Windows and Tomcat 5.5 (Java)?

China☆狼群 提交于 2019-12-04 03:20:06
I am using Windows 2008 R2 and Apache Tomcat 5.5, for your information. STDOUT and STDERR can be automatically logged through Apache Tomcat properties, via Logging tab -> Redirect Stdout and Redirect Stderror textboxes. But I want to control this through log4j. I'm trying to leverage ConsoleAppender and the TimeAndSizeRollingAppender class to rollover what would normally be controlled by Apache Tomcat's innate logging. Basically, however Tomcat redirects stdout and stderr to a file, I want to do the same thing using log4j and the log4j.properties file. I did some digging on this site and

How to redirect stdout stderr in an ant script?

你说的曾经没有我的故事 提交于 2019-12-04 02:56:30
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! ChssPly76 The recorder task may be able to do what you want: <record name="log.txt" action="start"/> ... <record name="log.txt" action="stop"/> Beyond that, certain tasks

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

烂漫一生 提交于 2019-12-04 02:43:40
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 pipe( READER, WRITER ) ; my $child = fork() ; if ( $child ) { print "I am the parent: My pid = $$ junior

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

痴心易碎 提交于 2019-12-04 02:10:52
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? Yes, mbq is right -- use Rscript , or, if it floats your boat, littler : $ cat /tmp/tommy.r #!/usr/bin/r cat("hello world\n") print(argv[]) $ /tmp/tommy.r a b c hello world [1] "a" "b" "c" $ You

Why does wget output to stderr rather than stdout?

被刻印的时光 ゝ 提交于 2019-12-04 01:49:45
After 30mins of futile attempt to capture the output of wget , I figured out that the program writes to stderr rather than the stdout . Searching in web and stack-overflow reveals this to be a well-known fact. Any idea why is this so? It's well known, because it's in the manual . Reporting messages on stderr is common, because messages are separated from regular output on stdout . This is useful when you combine several tools with a pipe. In this case it would be bad, when regular output and diagnostic messages were mixed up. 来源: https://stackoverflow.com/questions/13066518/why-does-wget

NodeJS spawn stdout string format

只谈情不闲聊 提交于 2019-12-04 01:19:26
I'm spawning a process in node and tracking the output of the command like this: proc.stdout.on("data", function (data) { console.log(data.toString()); }); It works well, however, the output seems to be splitting the lines: npm http 304 https://registry.npmjs.org/underscore The above is just one line out of the response from an npm install . Typically this is all in one line, it's also adding line breaks before and after the response. Is there a way to get the data output to look like the standard run, i.e. line-by-line? Streams are buffered and emit data events whenever they please (so to

How to test print statements?

纵饮孤独 提交于 2019-12-04 00:20:06
You want to write unittest -cases for a function like that: def test_me(a): for b in c: print do_something(a,b) At first I thought about just collecting the outputs of do_something in a string and then returning it, to print and test the whole output together. But it's not always convinient because such loops could cause your buffer string to get very big, depending on the circumstances. So what can you do to test the output, when it is printed and not returned? print prints to sys.stdout , which you can reassign to your own object if you wish. The only thing your object needs is a write

Shell process' standard output reading in Visual Basic 6

北战南征 提交于 2019-12-03 23:07:35
问题 First, let me say that I'm not a Visual Basic 6 expert... My need is to: launch from a VB6 client code an exeternal .exe file wait for the process to finish and - during its execution - read the messages coming from its standard output "on the fly" (so that I can print it on a text-filed widget or similars). I'm wondering if it is even possible to do that in VB6...after a long search on the Internet I didn't come up with anything. Found a lot of examples of how to use the Shell function, but