Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #8319

What if a subprocess disconnects stdin and/or stdout?

From Victor Porton <porton@narod.ru>
Newsgroups comp.programming
Subject What if a subprocess disconnects stdin and/or stdout?
Date 2018-01-22 00:43 +0200
Organization Aioe.org NNTP Server
Message-ID <p4353a$1is9$1@gioia.aioe.org> (permalink)

Show all headers | View raw


I am writing "Command Communication Library":
https://github.com/vporton/libcomcom

The most immediate purpose is to (synchronously as of the planned first 
release):

Run an OS command with the given string written to stdin and with stdout 
returned (as a string) to the caller after the command finished.

It is clear what to do if the child process exits.

But what if the child process does NOT exit but closes stdin and/or stdout? 
What should I do in this case? Should I kill the process? Should I wait when 
it finishes? Should I return the stdout now, even despite the process has 
not yet finished?

P.S. This libcomcom is a VERY long time should be already have been written. 
I wonder if I am the first person who solves this problem.

-- 
Victor Porton - http://portonvictor.org

Back to comp.programming | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

What if a subprocess disconnects stdin and/or stdout? Victor Porton <porton@narod.ru> - 2018-01-22 00:43 +0200
  Re: What if a subprocess disconnects stdin and/or stdout? Ed Prochak <edprochak@gmail.com> - 2018-01-26 10:53 -0800

csiph-web