Using PHP's proc_open(), I can start a process, read from STDOUT and STDERR (separately) an arbitrary number of bytes at a time using fread() while the process is running, detect when the process is done using feof() on the STDOUT and STDERR pipes, and then use proc_close() to get the exit code of the process. I've done all of this in PH...
I thought I was going to get the output from a QProcess using the following code:
// Start the process
process.start(tr("php-cgi www/test.php"),QIODevice::ReadWrite);
// Wait for it to start
if(!process.waitForStarted())
return 0;
// Continue reading the data until EOF reached
QByteArray data;
while(process.waitForReadyRead())
...
I've always been amazed/frustrated with how long it takes to simply output to the terminal with a print statement. After some recent painfully slow logging I decided to look into it and was quite surprised to find that almost all the time spent is waiting for the terminal to process the results.
Can writing to stdout be sped up somehow...
Should a Unix GUI application's warning be sent to std::cerr or std::cout?
This presumes that GUI normally presents the warnings and errors in a console window and also sends them to a log file. But in the case that the console is missing and thus cannot be used should std::cerr, std::cout, or std::clog be used for such messages?
I'm ...
Because I'm currently setting up a new server for use, I've been using a lot of command-line programs like curl and wget, and I've noticed that they do something interesting. When run in the Terminal, they print their current progress in place (e.g. 54% will become 55% in place, instead of 55% being printed on the next line - download a ...
Hi, I have a bash script with some scp commands inside.
It works very well but, if I try to redirect my stdout with "./myscript.sh >log", only my explicit echos are shown in the "log" file.
The scp output is missing.
if $C_SFTP; then
scp -r $C_SFTP_USER@$C_SFTP_HOST:$C_SOURCE "$C_TMPDIR"
fi
Ok, what should I do now?
Thank you
...
I just have begun with Perl and I want to write my own script to scan a document and convert the resulting TIFF file to a PDF file. If the conversion succeeds (using tiff2pdf), I want to print "Done" at the end of the line, but I can't seem to find a hint to do this on the Web.
My guess is that I have to get the geometry of the terminal...
I'm trying to capture the output of a windows program using Qt and Python.
I'm starting the process with QProcess, but the problem is the output is being buffered. Unfortunately I don't have access to the source, and therefore can't flush the output.
From my searching around, I found the program "Expect", but I don't know if there is...
So I have a function such as:
public static function UnorderedList($items, $field, $view = false){
if(count($items) > 0){
echo '<ul>';
foreach($items as $item){
echo '<li>';
if($view){
echo '<a href="'.$view.'id='.$item->sys_id.'" title="View Item">'.$item->$field.'</a>';
...
I have code that roughly looks like this (the entire code is a bit too long to copy here):
import re
from subprocess import Popen, PIPE
goodOutput = re.compile(r'\S+: 0x[0-9a-fA-F]{8} \d \d\s+->\s+0x[0-9a-fA-F]{8}')
p = Popen(['/tmp/myexe', param], stdout=PIPE, stderr=PIPE, cwd='/tmp')
stdout, stderr = p.communicate()
ret = goodOutp...
I created a Visual C++ test project which contains printf statements. Unfortunately, I can't find a method to view the output of this. It isn't included in the output window. Any suggestions?
...
I'm getting a slightly weird result from calling subprocess.Popen that I suspect has a lot to do with me being brand-new to Python.
args = [ 'cscript', '%USERPROFILE%\\tools\\jslint.js','%USERPROFILE%\\tools\\jslint.js' ]
p = Popen(args, stdout=PIPE, shell=True).communicate()[0]
Results in output like the following (the trailing doubl...
I am working with a console application for VB 10.
How can I replace data that I have already written with:
Console.Write
Or how can I write on a specific point: e.g. 100 lines, 100 chars left
In the same way that a program such as wget has a loading bar that does not keep getting replaced every time progress is increased.
...
When this program is run, the "stderr" line is displayed before the "stdout" line. Why? I thought dup2 would make stderr and stdout use the same file descriptor so there should be no problem with buffering. I'm using gcc 3.4.6 on Solaris 10.
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
int main()
{
int fd[2];
int p...
I create new process from a java code using ProcessBuilder
ProcessBuilder builder = new ProcessBuilder("/path/to/bin");
Process process = builder.start();
In this case, I am not interested in seeing error/output. Is it necessary to grab OutputStream and ErrorStream? Is it automatically ignored?
Output may be large (10MB) -- in some...
I am using BASH 4. I am trying to find a way to legitimately prepend output to indicate the type of output that it is. I am able to do this with something kind of like this...
ls -l /tmp/abcdefgh 2> >(sed 's/^/stderr: /') 1> >(sed 's/^/stdout: /')
stderr: ls: cannot access /tmp/abcdefgh: No such file or directory
ls -l /tmp/ 2> >(sed...
I have an application, let's call it myapp.exe, which is dual-mode console/GUI, built as /SUBSYSTEM:WINDOWS (There's a tiny 3KB shim myapp.com to cause cmd.exe to wait to display the new prompt.)
If I launch from a command prompt:
myapp -> cmd.exe runs myapp.com which runs myapp.exe. stdout is initially a detached console, by using A...
Right when I am at fflush(stdout) and I break there in GDB, can I know what is there in stdout before I actually print it?
How can I know what is there in stdout at any point in time?
...