stdout

whiptail: How to redirect output to environment variable?

I'm trying to use whiptail as it's a lightweight alternative to dialog and seems to be installed by default in most systems (i.e., people don't have to go around and install it if it's "forgotten" or wasn't installed by default). I checked question #1562666 for a few examples here, but I'm looking for an alternative for redirecting outpu...

Ruby stdio consts and globals, what are the uses?

Ruby has constants and global variables for stdio. Namely, the consts STDIN, STDOUT, STDERR, and their variable counterparts, $stdin, $stdout, $stderr. I understand the difference between a constant and a variable. I know the constants are immutably set to the file descriptors at the moment the script was exec'd. I also understand tha...

Is it possible to refresh two lines of text at once using something like a CR? (C++)

Right now, I have a console application I'm working on, which is supposed to display and update information to the console at a given interval. The problem I'm having is that with a carriage return, I can only update one line of text at a time. If I use a newline, the old line can no longer be updated using a carriage return. What can I...

Determine whether process output is being redirected in C/C++

I'm writing command line utility for Linux. If the output (stdout) is going to a shell it would be nice to print some escapes to colorize output. But if the output is being redirected those bash escapes shouldn't be print, or the content might break parsers that rely on that output. There are several programs that do this (suck as ack) ...

log4j console appender and log file size

I am using Jboss 4.0.2 in Solaris to run a webapp. JBoss is configured to use the factory default log4j.xml file, and this has a ConsoleAppender. I am redirecting stdout of jboss java process to a file. Something interesting happens when I try to cleanup this file - jboss.out. This is where I start. $ ls -alhrt jboss.out -rw-r--r-- ...

Is there a buffer size attached to stdout?

I am trying to find some information on data limits related to stdout on Windows. I can't seem to find the information on MSDN. Is there a limit to how much data can be written to stdout? If so, what happens if the limit is reached? Is the data lost? If stdout is redirected (for example, by launching the process from .Net and using the...

Capturing output from WshShell.Exec using Windows Script Host

I wrote the following two functions, and call the second ("callAndWait") from JavaScript running inside Windows Script Host. My overall intent is to call one command line program from another. That is, I'm running the initial scripting using cscript, and then trying to run something else (Ant) from that script. function readAllFromAny...

Display output of a Bash command and keeping the output in a variable

Hi again, I'm not sure if it is possible but what I want to do is to run a bash command and storing the output in a variable AND display it as if I launched the command normally. Here is my code: VAR=`svn checkout $URL` So I want to store the output in VAR and still see the result (and because svn checkout takes a long time, I can't ...

Where is System.err on Windows?

I have a Java GUI-based application that writes some diagnostic messages to System.out and System.err. Where are these messages output when running on Windows? (For example, on Mac OS X, they're printed to the system console log.) Edit I should add that the Java application is packaged as a .exe, so (right now) I can't launch it using ...

Stopping a program if the next process in the pipeline was stopped.

Hi all, when I'm running the following pipeline: cat my_large_file.txt | head | wc the process stops almost immediately. OK. but when I run my java program java MyProgramReadALargeFile my_large_file.txt | head | wc the output from 'wc' is printed to stdout but the java program is still running. How can it detects that the pipeline...

php: Grabbing stdout output data from cli tools?

Is it possible to grab the stdout output data from command line tools in php? Example: I want to upload a dynamically server-created mix of audio files to the client. The SOX tool lets me mix the input mp3s and send the result to stdout pipe. Could I grab this mix and instantly upload it, without the need of first saving it as a tempf...

way to send strings to stdout AND socket in 1 line

I want to write this to only 1 line: fprintf(stdout, "RCPT TO: <%s>\r\n", argv[argc-1]); fprintf(sockfd, "RCPT TO: <%s>\r\n", argv[argc-1]); so i want to send the same string to stdout and to my open socket. How can I do this? ...

Does reading from stdin flush stdout?

stdout is line-buffered when connected to a terminal, but I remember reading somewhere that reading (at least from stdin) will automatically flush stdout. All C implementations that I have used have done this, but I can't find it in the standard now. It does make sense that it works that way, otherwise code like this: printf("Type some...

Run Java class file from PHP script on a website

I have a website and want to be able to allow the user to run a Java file on the server from the website. I want the user to click a button which will run the Java file on the server AND anything printed to standard-out by the Java program will be printed out on the website for the user to see. How can this be done (call Java program ...

fork() and printf()

As I understood fork() creates a child process by copying the image of the parent process. My question is about how do child and parent processes share the stdout stream? Can printf() function of one process be interrupted by other or not? Which may cause the mixed output. Or is the printf() function output atomic? For example: The...

How to redirect stdout for a subprocess?

def StartProc(dir, parm): global proc proc_log = open(dir + os.sep + "MyLog.txt","w") #new path for each file if parm: proc = subprocess.Popen(path, 0, None, subprocess.PIPE, proc_log, None) else: MyReset(proc) #reset the process(proc) to its default values proc.stdout = ...

Is there a module which gives me an output of two colums ( or more ) on STDOUT?

Hello, is there a module which gives me an output of two columns ( or more ) on STDOUT? #!/usr/bin/env perl use warnings; use strict; printf "%0.3d\n", $_ for 1 .. 100; I'd like to have 1-50 in the first column and 51-100 in the second. ...

Where is stdout for a Mac App?

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,...

Does stdout have limitations

I had problems with imagemagik convert and unicode filenames. I then wrote a echo.bat which simply does echo %1. What came back in stdout via .NET wasnt my unicode characters. Is there some kind of character limitation? I havent tested length of characters i can pass as an argument is there a limit on that? ...

Bat redirecting stderr to stdout has weird behaviour

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...