Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #82277 > unrolled thread
| Started by | Robert Clove <cloverobert@gmail.com> |
|---|---|
| First post | 2014-12-10 15:52 +0530 |
| Last post | 2014-12-10 15:52 +0530 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Solution to a problem,write terminal output to file Robert Clove <cloverobert@gmail.com> - 2014-12-10 15:52 +0530
| From | Robert Clove <cloverobert@gmail.com> |
|---|---|
| Date | 2014-12-10 15:52 +0530 |
| Subject | Re: Solution to a problem,write terminal output to file |
| Message-ID | <mailman.16805.1418206969.18130.python-list@python.org> |
[Multipart message — attachments visible in raw view] — view raw
I think i didn't explained well
Two programs client and server in c.
to run client strace -c ./client
to run server strace -c ./server
After a minute i want to send client SIGINT signal and capture the terminal
output in a file.
If i use os.system and press ctrl+c signal from keyboard i get the output
on terminal if i use subprocess.Popen and press ctrl+c from keyboard i
didn't get the output.
Regards
On Wed, Dec 10, 2014 at 12:51 AM, Chris Angelico <rosuav@gmail.com> wrote:
> On Wed, Dec 10, 2014 at 4:11 AM, Robert Clove <cloverobert@gmail.com>
> wrote:
> > I am facing a problem in python coding that is
> >
> > I have a client server program(programs a re in c code and client and
> server
> > are its executable) on Linux machine.
> > To run client i do this ./strace -c client and to run server i type this
> > ./strace -c server
> >
> > When i give ctrl+c to client i see some output on the terminal, i want
> that
> > output in the file i mean i want to send the ctrl+c signal programmatic
> ally
> > to client after a minute and write the output in the file.
> >
> > if i use subprocess.Popen to execute ./strace -c client and give ctrl+c
> > signal i don''t see any output on the terminal but if i see os.system to
> > execute ./strace -c client i see the output on terminal.Now i want to
> send
> > the ctrl+c signal to os.system and write the terminal output into a file.
>
> I'm not entirely sure what you're trying to do here, but strace
> produces its output on Standard Error (aka "stderr"). You can simply
> redirect that to a file. That's the normal strace program. You might
> be running something completely different, since you're running
> "./strace"; but I would suggest that it probably uses either stderr or
> stdout ("Standard Output"), and you could redirect either or both. Try
> this, at the terminal (no Python involved):
>
> ./strace -c client >client_out 2>client_err
>
> Then press Ctrl-C, and see which of the files has the output. Based on
> that, you could configure subprocess.Popen to send the appropriate
> stream to a file.
>
> ChrisA
> --
> https://mail.python.org/mailman/listinfo/python-list
>
Back to top | Article view | comp.lang.python
csiph-web