pipe

no output from .NET console app run from psexec

I'm having a very strange problem where I run a managed .net console app on a remote server using psexec. I get this error "The process tried to write to a nonexistent pipe". Now I wrote an unmanaged C++ program to output to std::cout, and it works just fine. Interestingly, if I run cmd.exe remotely, and use the /u (unicode) option, I...

Turn off buffering in pipe

I have a script which calls two commands: long_running_command | print_progress The long_running_command prints a progress but I'm unhappy with it. I'm using print_progress to make it more nice (namely, I print the progress in a single line). The problem: The pipe activates a 4K buffer, to the nice print program gets nothing ... noth...

GCC on HP-UX, lots of poll(), pipe(), and file issues

I'm having a lot of trouble building a 'middleman' logger - the intention is to place it on the path above an item in /usr/bin and capture everything going to and from the application. (Black box 3rd-party app is failing FTP for some reason.) Once run, the middleman will fork, redirect stdout and stdin to/from pipes that the parent has...

Python - Subprocess - How to call a Piped command in Windows?

How do I run this command with subprocess? I tried: proc = subprocess.Popen( '''ECHO bosco|"C:\Program Files\GNU\GnuPG\gpg.exe" --batch --passphrase-fd 0 --output "c:\docume~1\usi\locals~1\temp\tmptlbxka.txt" --decrypt "test.txt.gpg"''', stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, ) stdout_va...

Problem with non blocking fifo in bash

Hi! I'm running a few Team Fortress 2 servers and I want to write a little management script. Basically the TF2 servers are a fg process which provides a server console, so I can start the server, type status and get an answer from it: ***@purple:~/tf2$ ./start_server_testing Auto detecting CPU Using AMD Optimised binary. Server will ...

Turning C output into C# input

I am currently trying to develop a program which takes the output of an existing program (written in C) and uses it as input (in C#). The problem I am having is that the existing program prints data in redundant format but it dynamically changes. An example could be a random name generator and I need to make a program that logs all of t...

Python: is os.read() / os.write() on an os.pipe() threadsafe?

Hello! Consider: pipe_read, pipe_write = os.pipe() Now, I would like to know two things: (1) I have two threads. If I guarantee that only one is reading os.read(pipe_read,n) and the other is only writing os.write(pipe_write), will I have any problem, even if the two threads do it simultaneously? Will I get all data that was written ...

how can I create pipe and pass to g_io_channel_win32_new_fd

I'm using gtk on windows and I need an ability to create a pipe for communication between processes via g_io_channel_win32_new_fd. How do you do that on windows? ...

Check whether stderr is a pipe in bash

I have a bash script that prompts the user for input with 'read'. If stdout or stderr is piped to something other than a terminal, I would like to suppress this step. Is that possible? ...

How do you construct a read-write pipe with lua?

I'd like to do the equivalent of: foo=$(echo "$foo"|someprogram) within lua -- ie, I've got a variable containing a bunch of text, and I'd like to run it through a filter (implemented in python as it happens). Any hints? Added: would really like to do this without using a temporary file ...

Python - capture Popen stdout AND display on console?

Hi, I want to capture stdout from a long-ish running process started via subprocess.Popen(...) so I'm using stdout=PIPE as an arg. However, because it's a long running process I also want to send the output to the console (as if I hadn't piped it) to give the user of the script an idea that it's still working. Is this at all possible?...

Named pipe similar to "mkfifo" creation, but bidirectional

I'd like to create a named pipe, like the one created by "mkfifo", but one caveat. I want the pipe to be bidirectional. That is, I want process A to write to the fifo, and process B to read from it, and vice-versa. A pipe created by "mkfifo" allows process A to read the data its written to the pipe. Normally I'd use two pipes, but I am t...

How to get output from external command combine with Pipe

I have command like this. wmctrl -lp | awk '/gedit/ { print $1 }' And I want its output within python script, i tried this code >>> import subprocess >>> proc = subprocess.Popen(["wmctrl -lp", "|","awk '/gedit/ {print $1}"], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) >>> proc.stdout.readline() '0x0160001b -1 6504 ...

Using SAS Macro to pipe a list of filenames from a Windows directory

I am trying to amend the macro below to accept a macro parameter as the 'location' argument for a dir command. However I cannot get it to resolve correctly due to the nested quotes issue. Using %str(%') does not work, neither do quoting functions for some reason. The macro will work fine when the filepath has no spaces (eg C:\temp\wit...

manipulating pipe buffer size in C or python

hello, I have a general question about popen (and all related functions), applicable to all operating systems, when I write a python script or some c code and run the resulting executable from the console (win or linux), i can immediately see the output from the process. However, if I run the same executable as a forked process with its ...

execl pipe without dup

Hello everyone, I am trying to execute a program from a parent using execl. I do the normal pipe setup and fork. Here is the trick... I need my children (there can be an arbitrary number of children) to all communicate with the parent. Program "A" (parent) creates pipe forks and execl into "B" (child). In the main() function of prog...

Is there any way to synchronize parent and child in C using one pipe in Unix?

Suppose both parent and child use one pipe for writing and reading means when one writes then only other read otherwise it blocks. Is there any way to do it? I tried to do it with sleep function but due to race conditions, it does not give the correct output. This is my code #include <stdio.h> #include <stdlib.h> #include <string.h> #i...

A doubt on pipes in Unix

This code below is for executing ls -l | wc -l. In the code, if I comment close(p[1]) in parent then the program just hangs, waiting for some input. Why it is so? The child writes output of ls on p1 and parent should have taken that output from p0. #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> #includ...

Command Line Pipe Input in Java

Here is a simple piece of code: import java.io.*; public class Read { public static void main(String[] args) { BufferedReader f = new BufferedReader(new InputStreamReader(System.in)); while(true) { String x = null; try{ x = f.readLine(); } catch (IOException e) {e.printStackTrace();} System.out.println(x); ...

Python 2.6 send connection object over Queue / Pipe / etc.

Given this bug (Python Issue 4892) that gives rise to the following error: >>> import multiprocessing >>> multiprocessing.allow_connection_pickling() >>> q = multiprocessing.Queue() >>> p = multiprocessing.Pipe() >>> q.put(p) >>> q.get() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/.../python2.6/...