I get a weird error ("The process tried to write to a nonexistent pipe.") if I stop reading from piped input, from a program that works fine for non-piped input. How can I avoid causing this error?
code:
package com.example.test;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class...
I'm testing subprocesses pipelines with python. I'm aware that I can do what the programs below do in python directly, but that's not the point. I just want to test the pipeline so I know how to use it.
My system is Linux Ubuntu 9.04 with default python 2.6.
I started with this documentation example.
from subprocess import Popen, PIPE...
According to a section in this presumably accurate book,
A common use of pipes is to read a
compressed file incrementally; that
is, without uncompressing the whole
thing at once. The following function
takes the name of a compressed file as
a parameter and returns a pipe that
uses gunzip to decompress the
contents:
de...
I wonder if it is possible to shut down the communication pipe when killing a subprocess started in a different thread. If I do not call communicate() then kill() will work as expected, terminating the process after one second instead of five.
I found a discussion of a similar problem here, but I got no real answers. I assume that I eit...
I want to do this:
run a command
capture the output
select a line
select a column of that line
Just as an example, let's say I want to get the command name from a $PID (please note this is just an example, I'm not suggesting this is the easiest way to get a command name from a process id - my real problem is with another command who...
My query is on what is the best way to read / write to a linux Pipe in Java? I already am using the java.io.RandomAccessFile like
RandomAccessFile file = new RandomAccessFile("/dev/zap/16", "rw");
and then passing it to worker thread which reads it after every 2ms as
byte[] buffer = new byte[16];
file.read(buffer);
It does r...
Hi,
I am working in a bash script where I need to analyze the output of an FTP session. But I encountered a problem with SUSE Linux FTP client when connecting to an AIX ftp server.
The problem is that the output from the FTP command is beign shown on the screen, but is not being send to a pipe if a do a "| grep" or "| awk". Also, if I o...
How to run the following command using subprocess.Popen?
mysqldump database_name table_name | bzip2 > filename
I know os.system() can do the job but I dont want to wait for the dump to finish in main program.
...
I'm working on a web mapping service and would like to provide my users with a Python API that they can use to create custom plugins. These plugins would be running on my server so I'm trying to lock down Python as much as possible.
To ensure that users can't access files they are not supposed to, I'm planning on running the plugins ins...
I am trying to create a pipe to use between two processes to send information. The two process are not related and implementation with signals has a problem where if the process that recieves the signal is doing a sys command it intreprets the signal as an intrupt.
I am new to perl so any help trying to have two processes use pipes woul...
I have a Perl script that executes a long running process and observes its command line output (log messages), some of which are multiple lines long. Once it has a full log message, it sends it off to be processed and grabs the next log message.
open(PS_F, "run.bat |") or die $!;
$logMessage = "";
while (<PS_F>) {
$lineRead = $_;
...
I have the following script structure: script A opens PIPE on B, and B opens PIPE on C. So the dataflow is A->B->C. B catches SIGPIPE. Though descriptors IN and OUT are opened:
$SIG{'PIPE'} = sub {
$logger->info('caught PIPE signal.');
$logger->info("STDIN status: ".STDIN->opened());
$logger->info("STDOUT status: ".OUT->opened());
die;
...
Using this tutorial i came up with the code below. My client is ran frequently. Its activated via clicks and possibly can be launched twice at the same moment in certain circumstance. I am worried one client may close while another client opens which causes the pipe to be closed in that slim few milliseconds. Whats the best way to keep t...
Hi,
I'm trying to create a simple shell in C for Unix. I've been able to do all the parsing of commands and execution, but I'm having a problem with piping. I think the problem is that I'm not hooking into the correct pipe for the input of the second command.
For example, if I type "ls | wc", it will pause after the "wc" command, which...
I want to do a popen() / python's subprocess.communicate from Haskell - start a program, give it stdin, and get its stdout/stderr. What's the most direct / Haskellish way to do this?
...
I've Got two Programs (Server / Client)
I'm trying to setup IPC for them (They both run on the same box)
Using System.IO.Pipes & Net 3.5
When I call ComOpen, it opens the Pipe correctly, sends the Process ID to the server, but then the Pipe closes and I get an error when it tries to send "Second Write Test"
So Question is.
How do I kee...
I would like to do the following inside a C program on a Linux os:
Create a PIPE using a syscall (or 2)
Execute a new process using exec()
Connect the process's STDIN to to the previously created pipe.
Connect the process's output to another PIPE.
The idea is to circumvent any drive access for performance purposes.
I know that the ...
I am not Yahoo Pipes user but I do not know anything about programming.
I use Yahoo Pipes to generate RSS feeds from several websites that allow me to use their feeds on my site. What I need is to clean up these sites from all the unwanted styles like this:
<div style="font-family:Tahoma, Geneva, sans-serif;font-size:12px;direction:rtl;...
I have an apparently simple regex query for pipes - I need to truncate each item from it's (<img>) tag onwards. I thought a loop with string regex of <img[.]* replaced by blank field would have taken care of it but to no avail.
Obviously I'm missing something basic here - can someone point it out?
The item as it stands goes along some...
I'd like to save a copy of some of my pipes offline before I go to edit them, and possibly reload them from an external source again in future.
Can this be done?
...