2

I am facing a weird problem. Every time I call a particular command cmd via subprocess.Popen(cmd).wait(), the stty gets bad (does not echo my further commands on the shell, newline does not work, etc.) when the command is over. I have to run stty sane to get the stty fine again. What could be the reason for this?

Update The command I am running is starting the elasticsearch process. The command launches the process in the background.

amit kumar
  • 20,438
  • 23
  • 90
  • 126
  • What command are you executing? – Geo Sep 27 '11 at 07:49
  • why would you want to do elasticsearch stuff on the console via python when there is at least one phyton client for ES? – Karussell Sep 27 '11 at 22:01
  • @Karussell Yes, I use pyes. But I could not find a way to start the elasticsearch server via pyes, which is what I am doing above. – amit kumar Sep 28 '11 at 04:29
  • 1
    in java you start a node via NodeBuilder - isn't that possible with pyes too? – Karussell Sep 29 '11 at 22:07
  • @Karussell http://packages.python.org/pyes/guide/reference/java-api/client.html is the NodeBuilder API in java. But probably it is not available in pyes. – amit kumar Sep 30 '11 at 05:04

1 Answers1

0

It's possible that the command you're running is emitting some escape sequences into your terminal that are changing its mode or other settings. Programs that need the full terminal capability do that (e.g. text based editors).

Capturing the standard output of the program you're executing and preventing it from going to the screen might help. Have you tried that?

Noufal Ibrahim
  • 71,383
  • 13
  • 135
  • 169