When printing the "usage" of an application, should it be done on stdout or on stderr?
Depending on the application I've seen several cases, but there doesn't seem to be one rule. Maybe I'm mistaken and there is one good practice. In that case, what is it?
...
I'm trying to check for an SVN tag existence from a Perl script. So I try calling svn info $url, read exit code and suppress standard output and standard error streams. However, I struggle to do this elegantly (there are probably better ways to ask SVN about a tag, but that's not the point here):
my $output = `svn info $url/tags/$tag`;
...
Hi,
I was writing a command line program which will have a status bar, much like wget.
The main problem I'm facing is: how do I delete what I've already sent into stdout/stderr?
I had on idea: use the backspace char '\b' and erase the output I've sent. Is that the best way? Is it the only way? Is there a better way?
PS: I don't want ...
I've got an unmanaged DLL that is writing log messages to standard output. I'm calling this DLL with P-invokes from a WPF app and I need to get the standard output stream log. I've tried Console.SetOut, but that only seems to capture information written using Console.Write, etc.
Anyone have any ideas? I've found similar questions asked ...
How can I read from the stdout of my program?
One of my threads needs to access the stdout to read what the other threads are logging.
I'm using the dear old plain C.
...
How would I go about reading a string from stdin and formatting as such to stdout?
For example:
If I receive someone's name:
John Doe 03 17
I want to create user name for him as such:
jd0317
Although it can change to for someone with a middle name:
Jane B. Doe 05 18
Then it would be:
jbd0518
I assume you would read the line and then...
I am catching emails to "script@localhost" with /etc/aliases:
script: root,"|/path-to-my-script"
this gets an email on STDIN and I am parsing and passing it to other scripts.
#!/usr/bin/ruby
email = ARGF.read
...parse...parse-some-more...
system("/my-other-script.sh #{email.todo}")
the question is - what would be a best way to ca...
I am using python logging module and I want to disable the console logging for some time but it doesn't work.
#!/usr/bin/python
import logging
logger = logging.getLogger() # this gets the root logger
# ... here I add my own handlers
#logger.removeHandler(sys.stdout)
#logger.removeHandler(sys.stderr)
print logging.handl...
Hi, I'm looking for a way to redirect stdout to a Gtk::TextView widget in gtkmm. Ideally, I want it to work both on Windows and UNIX-like OSes.
So far, I've tried to redirect stdout to a file, then monitor changes to this file using Glib, like so (highly inspired from the gtkmm examples on gnome.org) :
#include <stdio.h>
#include <fcn...
What I'm trying to do is simply have the output of some terminal commands print out to a wx.TextCtrl widget. I figured the easiest way to accomplish this is to create a custom stdout class and overload the write function to that of the widget.
stdout class:
class StdOut(sys.stdout):
def __init__(self,txtctrl):
sys.stdout._...
Hi guys,
The following command which you can use in the cygwin console to output text in this console.
ruby -e 'STDOUT << "ABC" << " DEF"'
My question is: the STDOUT part is a ruby keyword or a cygwin keyword? How can I use it? Great thanks.
...
I've written a simple program that captures and executes command line Python scripts, but there is a problem. The text passed to a Python input function isn't written to my program despite my program capturing stdout.
For example:
The Python script:
import sys
print("Hello, World!")
x = input("Please enter a number: ")
print(x)
prin...
Hello folks,
One of the binaries which I am using in my shell script is causing a segmentation fault (RETURN VALUE: 139)
And even though, I am redirecting both stdout and stderr to a logfile, the Segmentation Fault error messages is displayed in the terminal when I am running the shell script.
Is it possible to redirect this message ...
I need to launch a number of long-running processes with subprocess.Popen, and would like to have the stdout and stderr from each automatically piped to separate log files. Each process will run simultaneously for several minutes, and I want two log files (stdout and stderr) PER process to be written to as the processes run.
Do I need t...
Hi, I'm running a script to manage processes on a remote (SSH) machine. Let's call it five.py
#!/usr/bin/python
import time, subprocess
subprocess.call('echo 0',shell=True)
for i in range(1,5):
time.sleep(1)
print(i)
If i now run
ssh user@host five.py
I would like to see the output
0
1
2
3
4
appear on my standard out se...
I have a problem that writes information to stdout and stderr, and I need to grep through what's coming to stderr, while disregarding stdout.
I can of course do it in 2 steps:
command > /dev/null 2> temp.file
grep 'something' temp.file
but I would prefer to be able to do is without temp files. Any smart piping trick?
...
I'm looking to expose an interactive command line program via JSON or another RPC style service using Ruby. I've found a couple tricks to do this, but im missing something when redirecting the output and input.
One method at least on linux is to redirect the stdin and stdout to a file then read and write to that file asynchronously wit...
I'm using Python's subprocess.Popen to perform some FTP using the binary client of the host operating system. I can't use ftplib or any other library for various reasons.
The behavior of the binary seems to change if I attach a stdin handler to the Popen instance. For example, using XP's ftp client, which accepts a text file of commands...
Is there any way to write binary output to sys.stdout in Python 2.x? In Python 3.x, you can just use sys.stdout.buffer (or detach stdout, etc...), but I haven't been able to find any solutions for Python 2.5/2.6.
EDIT, Solution:
From ChristopheD's link, below:
import sys
if sys.platform == "win32":
import os, msvcrt
msvcrt.se...
I have a php script that is running in CLI and I want to display the current percent progress so I was wondering if it is possible to update the STDOUT to display the new percent.
When I use rewind() or fseek() it just throws an error message.
...