java - jmx-term python subprocess poisons shell -


#!/usr/bin/env python  subprocess import *  p = popen(   args=("java","-jar","jmxterm-1.0-alpha-4-uber.jar"),    bufsize=0,    stdin=pipe,   stderr=pipe   )  p.stdin.write("open localhost:12345\n") x = p.stderr.readline() 

this needs java process listening jmx client on port 12345. script "works": x correct (when print or @ in pdb).

what's problem then? when script terminates, shell behaves strangely. on linux , os-x, typing in shell isn't visible (although output is), , on windows, first 2 characters typed per command ignored. executing terminal "reset" command seems fix it, don't want inflict on users of script.

removing last line of script (accessing p.stderr.readline()) eliminates problem, script's utility.

i've removed authentication simplify example. you'll note don't print x, eliminate writing nasty the shell culprit.

versions: cpython 2.7 on snow leopard , various linuxes; cpython 2.6.3 on windows 7

jmxterm doing initialization interactive use on terminal , either because of bug or because don't close explicitly it's not cleaning after itself. easiest way avoid connect stdout pipe, too, other standard streams.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -