Hi: I want to redirect stdout to a NSTextView. Could this also work with outputs of subprocesses? What might be the best way to achieve this?
EDIT:
According to Peter Hosey answer I implemented the following. But I do not get a notification. What am I doing wrong?
NSPipe *pipe = [NSPipe pipe];
NSFileHandle *pipeHandle = [pipe f...
I've got a script that calls out to a bunch of commands, some of which are noisy to stdout, some to stderr, some to both. I intend the script to be run by cron, so I don't want it to be noisy and mail me every day -- only in error conditions. So I do:
be_quiet() {
# save stderr in FD 3
exec 3>&2
exec &> /dev/null
}
die() {
...
To redirect (and append) stdout and stderr to a file, while also displaying it on the terminal I do this:
command 2>&1 | tee -a file.txt
However, is there another way to do this such that I get an accurate value for the exit status?
That is if I test $?, I want to see the exit status of 'command' and not the exit status of tee.
I kn...
#include<stdio.h>
#include<signal.h>
#include<stdlib.h>
void handler(int signo)
{
printf("First statement");
system("date");
exit(EXIT_SUCCESS);
}
int main()
{
signal(SIGINT,handler);
printf("Waiting for KeyboardInterrupt\n");
for(;;);
return 0;
}
Test run:-
shadyabhi@shadyabhi-desktop:~/c$ gcc main.c
shad...
I am writing a bash script and need to redirect the stdout and stderr output of a command i run to a single file, prefixing each line with stderr or stdout, accordingly.
is there a simple way to do this?
...
In a basic Unix-shell app, how would you print to stdout without disturbing any pending user input.
e.g. Below is a simple Python app that echos user input. A thread running in the background prints a counter every 1 second.
import threading, time
class MyThread( threading.Thread ):
running = False
def run(self):
self....
I'm new to Perl and want to know of a way to run an external command (call it prg) in the following scenarios:
Run prg, get its stdout only.
Run prg, get its stderr only.
Run prg, get its stdout and stderr, separately.
...
I am trying to encode ogg files at -q 6/192k. ffmpeg doesnt seem to be listenting to my command
ffmpeg -i blah -acodec vorbis -ab 192k -y out.ogg
So i would like to use the recommended ogg encoder. It says the input must be wav or similar. I would like to pipe a wav from ffmpeg to ogg. However not only am i unsure if oggenc2 will acc...
I have an array of double pointers, but every time I try do print one of the values the address gets printed. How do I print the actual value?
cout << arr[i] ? cout << &arr[i] ? they both print the address
Does anyone know?
...
Is there a way to align text when priting using cout? I'm using tabs, but when the words are too big they won't be aligned anymore
Sales Report for September 15, 2010
Artist Title Price Genre Disc Sale Tax Cash
Merle Blue 12.99 Country 4% 12.47 1.01 13.48
Richard Music 8.49 Classical 8% 7.81 0.66 ...
When running the following code I get no output but I cannot work out why.
# include <stdio.h>
int main()
{
fputs("hello", stdout);
while (1);
return 0;
}
Without the while loop it works perfectly but as soon as I add it in I get no output. Surely it should output before starting the loop? Is it just on my system? Do I...
I want to do something like this
ffmpeg -i audio.mp3 -f flac - | oggenc2.exe - -o audio.ogg
i know how to do ffmpeg -i audio.mp3 -f flac using the process class in .NET but how do i pipe it to oggenc2?
Any example of how to do this (it doesnt need to be ffmpeg or oggenc2) would be fine.
...
Hello. Well, I have a simple question, at least I hope its simple. I was interested in win32 console for a while. Our teacher told us, that windows console is just for DOS and real mode emulation purposes. Well, I know it is not true, becouse DOS applications are runned by emulator which only uses console to display output. Another thing...
Is there a good cheat sheet demonstrating the many uses of BASH shell redirection? I would love to give such a thing to my students. Some examples I'd like to see covered:
cmd > output_file.txt #redirect stdout to output_file.txt
cmd 2> output_file.txt #redirect stderr to output_file.txt
cmd >& outpout_file.txt #redirec...
I have a weird issue with printing data out. I use printf to print a char* string and then after that print another one. However part of the first string doesn't get printed and when I print the second string the missing part of the first one is pretended to that one. What is happening here?
I'm writting a simple libpcap implimentatio...
I have been trying to capture stdout and stderr output from a DLL compiled in MSVC++ that my Delphi app statically links to, but so far have been unsuccessful.
procedure Test;
var
fs: TFileStream;
begin
fs := TFileStream.Create('C:\temp\output.log', fmCreate or fmShareDenyWrite);
SetStdHandle(STD_OUTPUT_HANDLE, fs.Handle);
SetS...
I'm creating a Cocoa Application, which will need to run the rails command. This command generates an output, and streams it to stdout. I want to show this output to the user in an NSTextView (so basicly stream the stdout to the NSTextView). My application should not 'hang' when the command is running (e.g. the git command takes a long t...
I'm running java with the -verbose:gc option to measure garbage collector behavior, but it sends the info to stdout, mixing with my program's normal output. How do I tell it to output this info to stderr?
...
I have a program running on multiple machines with NFS and I'd like to log all their outputs into a single file. Can I just run ./my_program >> filename on every machine or is there an issue with concurrency I should be aware of? Since I'm only appending, I don't think there would be a problem, but I'm just trying to make sure.
...
This command:
keytool -import -file "$serverPath/$serverCer" -alias "$clientTrustedCerAlias" -keystore "$clientPath/$clientKeystore" -storepass "$serverPassword" -noprompt
Will when it runs successfully outputs: Certificate was added to keystore
I tried redirecting the stdard out with:
keytool ... > /dev/null
But it is still prin...