stdout

How can I put a process to background after its execution with broken CTRL+Z?

The question is special because some keys, such as CTRL+Z, stopped working. I tried to put the process to background by typing in the order: find / CTRL+Z bg However, I can still see the stdout. The only difference to only doing the first step is that the command CTRL+Z does not work anymore. It is rather nasty when I ...

How do I get 'real-time' information back from a subprocess.Popen in python (2.5)

I'd like to use the subprocess module in the following way: create a new process that potentially takes a long time to execute. capture stdout (or stderr, or potentially both, either together or separately) Process data from the subprocess as it comes in, perhaps firing events on every line recieved (in wxPython say) or simply print...

How to ignore arrow keys in C reading from stdin?

I'm reading from the standard input using the read() system call but there's a tiny thing that bothers me. I can't use the arrow keys... What I really wanted to do was to use arrow keys to go back and forth within the typed text but I think that's not that easy... So, what I at least want to do, is to ignore them. Right now, pressing an...

Limit on cout stream?

A puzzle that hit me. In some simple test harness code, if I stream too many characters to stdout, the program fails. Strange but very reproducable. This may be a Windows only issue, but it's easy to see: #include <iostream> #include <deque> using namespace std; int main() { deque<char> d; char c; while (cin.get(c)) d.push_b...

How to redirect TO stdout?

I have a UNIX application written in ansi C that writes data directly to a file. This file is specified by one of the argument parameters. For testing purposes, I can use /dev/null for the filename, which effectively redirects the output to nothing. I would like to be able to redirect the output to stdout by a similar method. Is th...

C# bi-directional IPC over stdin and stdout

How can I connect two C# processes so they can communicate with each other over stdin and stdout? Like this: Process A --> stdout A --> stdin B ---> Process B Process A <-- stdin A <-- stdout B <--- Process B ...

How can I capture the stdout output of a child process?

I'm trying to write a program in Python and I'm told to run an .exe file. When this .exe file is run it spits out a lot of data and I need a certain line printed out to the screen. I'm pretty sure I need to use subprocess.popen or something similar but I'm new to subprocess and have no clue. Anyone have an easy way for me to get this don...

Format text for STDOUT in Ruby

Hello, I am writting a small Ruby script that will run in a CLI. To improve the interface, I need to would love to add color/boldness to some elements that I output. Is that doable? If so (and I am almost sure this is), how? Thanks a bunch ...

how to redirect STDOUT to a file in PHP?

The code below almost works, but it's not what I really meant: ob_start(); echo 'xxx'; $contents = ob_get_contents(); ob_end_clean(); file_put_contents($file,$contents); Is there a more natural way? ...

How to buffer stdout in memory and write it from a dedicated thread

I have a C application with many worker threads. It is essential that these do not block so where the worker threads need to write to a file on disk, I have them write to a circular buffer in memory, and then have a dedicated thread for writing that buffer to disk. The worker threads do not block any more. The dedicated thread can saf...

python: find out if running in shell or not (e.g. sun grid engine queue)

is there a way to find out from within a python program if it was started in a terminal or e.g. in a batch engine like sun grid engine? the idea is to decide on printing some progress bars and other ascii-interactive stuff, or not. thanks! p. ...

Redirecting FORTRAN (called via F2PY) output in Python

Hi, I'm trying to figure out how to redirect output from some FORTRAN code for which I've generated a Python interface by using F2PY. I've tried: from fortran_code import fortran_function stdout_holder = sys.stdout stderr_holder = sys.stderr sys.stdout = file("/dev/null","w") fortran_function() sys.stdout.close() sys.stderr.close() sys...

Python - Print on stdout on a "terminal"

Before starting, I ask you all to apologize for the question. Maybe it is stupid, but I cannot find a solution !!! I am working on a remote machine, I HAVE NO IDEA OF WHAT TYPE !!! My python code, that seems to work, is the one below. The problem is that I am trying to print some outputs on the screen but nothing happens ! I have trie...

Strange stdout behavior in C++

I want my program to display the unix windmill while processing. There's a for loop and in every iteration theres a printf function: printf("Fetching articles (%c)\r",q); q is one of the characters in the windmill (-\|/) depending on the iteration number. The problem is - it seems like in 100 iterations there are only two changes in ...

Opening a TStream on stdin/stdout in a Delphi console app

I'm trying to write a Delphi console application that creates a TStream for its standard input, and another TStream for its standard output. (It will be launched by a host app with its input and output redirected to pipes, and will be passing binary data to/from that host app, so TStream will be much better-suited to the task than ReadL...

'app --help' should go to stdout or stderr?

I think stdout, so you can easily grep, what do you think? ...

How to get continuous output of subprocess started using backtick in ruby

I have a ruby application that executes ant as a subprocess using backtick. This works without any problems. When I do puts ant, ruby waits for the subprocess, ant, to finish completely and then prints the output to stdout. How do I get ruby to print the output from the subprocess continuously? ...

How do I invoke a Java process from Windows Powershell?

I am having trouble running a Java program with Windows Powershell 2.0. Any help on this would be greatly appreciated. I want the string "Hello World!" to print to the main Powershell console window. Instead, its getting printed to a separate process window that opens then suddenly closes. I don't know exactly how to tell the p...

NAnt exec doesn't work with stdin redirection?

I'm trying to use jsmin with nant - and it just uses stdin and stdout for input and output. The nant 'exec' task allows you to redirect the output to a file, but not get the input from a file. I have tried with a 'commandline' using '>' and '<' to direct the input and output, but nant just goes away and doesn't come back :( I can't bel...

Sending output to stdout (console) in a VB.NET win form project

I have an application with a String variable that repeated gets a Date from a database, does something with that field, then goes onto the next row. Is there a way I can send send out some debugging information to the stdout console so I can debug better/view the progress of the program? ...