Questions tagged [stdout]

The standard output stream (stdout) is the stream where a program writes its output data.

4740 questions
20
votes
2 answers

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

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…
Selmak
  • 205
  • 1
  • 2
  • 4
20
votes
5 answers

Retaining output colors when shelling out to node

I have a little Grunt task that shells out via node and runs "composer install". var done = this.async(); var exec = require('child_process').exec; var composer = exec( 'php bin/composer.phar install', function(error, stdout, stderr) { …
Jeroen De Dauw
  • 10,321
  • 15
  • 56
  • 79
20
votes
5 answers

Disabling Spring log, to have readable logs

How can I disable Spring logs to have log outputs that I can easily read or someone else can read. An answer to a similar question at, how to disable spring bean loading log suggested to comment out all lines having org.springframework substring in…
LeandreM
  • 943
  • 3
  • 12
  • 24
20
votes
2 answers

Redirect stdout+stderr on a C# Windows service

I've written a Windows service in C# using the ServiceBase helper. During its execution, some procedures in an external native DLL are called. Annoyingly, those procedures write to stdout and/or stderr in an uncontrolled manner as no sources are…
Herchu
  • 325
  • 1
  • 4
  • 9
20
votes
1 answer

ffmpeg: which file formats support stdin usage?

I know ffmpeg is able to read data from stdin rather than reading from disk using ffmpeg -i -. Is this supported for all file formats? If it is not, is there a list which file formats are supported?
The Wavelength
  • 2,836
  • 2
  • 25
  • 44
19
votes
4 answers

How to reroute stdout, stderr back to /dev/tty

I just ssh-ed to some remote server and found that stdout and stderr of all commands/processes I am trying to run in bash is redirected to somewhere. So, I got following questions How to detect: 1) Which file stdout, stderr is beeing rerouted in…
Sergey
  • 785
  • 1
  • 5
  • 14
19
votes
4 answers

Output raw image from Imagick image in PHP

I'm using Imagick lib to do some modifications to original image. Then I'd like to output it directly to browser without saving. Is there a way to do that? I tried to use Imagick::writeImage('STDOUT') (empty output) and 'php://stdout' with error…
WASD42
  • 2,352
  • 6
  • 27
  • 41
19
votes
4 answers

Logging functions in bash and stdout

I'd like to be able to put log messages in the middle of bash functions, without affecting the output of those very functions. For example, consider the following functions log() and get_animals(): # print a log a message log () { echo "Log…
Adam
  • 2,110
  • 3
  • 14
  • 17
19
votes
2 answers

How do I detect if stdout is connected to a tty in Perl?

I'm looking for the Perl equivalent to this Python code: from sys import stdout if stdout.isatty(): print "yes" else: print "no"
bukzor
  • 37,539
  • 11
  • 77
  • 111
19
votes
3 answers

Node.js spawning a child process interactively with separate stdout and stderr streams

Consider the following C program (test.c): #include int main() { printf("string out 1\n"); fprintf(stderr, "string err 1\n"); getchar(); printf("string out 2\n"); fprintf(stderr, "string err 2\n"); fclose(stdout); } Which…
gratz
  • 1,506
  • 3
  • 16
  • 34
19
votes
5 answers

Writing unicode strings via sys.stdout in Python

Assume for a moment that one cannot use print (and thus enjoy the benefit of automatic encoding detection). So that leaves us with sys.stdout. However, sys.stdout is so dumb as to not do any sensible encoding. Now one reads the Python wiki page…
Sridhar Ratnakumar
  • 81,433
  • 63
  • 146
  • 187
19
votes
2 answers

Understanding stdin stdout stderr

I'm trying to understand stdin stdout and stderr. I see them used in people's code all the time and I can't understand exactly what they are. I am assuming that they have something to do with input/output but have been searching for an explanation…
Alex Mollberg
  • 231
  • 3
  • 5
  • 9
19
votes
3 answers

Why does 2>&1 need to come before a | (pipe) but after a "> myfile" (redirect to file)?

When combining stderr with stdout, why does 2>&1 need to come before a | (pipe) but after a > myfile (redirect to file)? To redirect stderr to stdout for file output: echo > myfile 2>&1 To redirect stderr to stdout for a pipe: echo 2>&1 |…
Rob Bednark
  • 25,981
  • 23
  • 80
  • 125
18
votes
2 answers

Test stdout and stderr redirection in bash script

I would like to test in my bash script where stdout and stderr are directed, or more precisely, if they have been redirected. Have you an idea ? The $* bash variable don't give me this info.
Sigmun
  • 1,002
  • 2
  • 12
  • 23
18
votes
4 answers

PHP CLI doesn't use stderr to output errors

I'm running the PHP CLI through a NSTask in MacOS, but this question is more about the CLI itself. I'm listening to the stderr pipe, but nothing is output there no matter what file I try to run: If the file type is not a plain text, stdout sets to…
Petruza
  • 11,744
  • 25
  • 84
  • 136