terminal input not appearing
import subprocess
import threading
import time
class terminal(threading.Thread):
def run(self):
self.prompt()
def prompt(self):
x = True
while x:
command = raw_input()
x = self.interpret(command)
def interpret(self,command):
if command == 'exit':
#_conf.cancel()
#_conf.allclear.wait()
return False
else:
print 'Invalid Command'
return True
command = 'java -jar ../bukkit/craftbukkit.jar'
#startcmd = 'java -Xmx' + str(self.config['start_heap']) + 'M -Xms' + str(self.config['max_heap']) + 'M -jar ' + str(path)
#stopcmd = 'screen -S ' + self.config['screen_bukkit'] + ' -p 0 -X stuff "`printf "stop\r"`"'
term = terminal()
term.start()
p = subprocess.Popen(command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
while (p.poll() == None):
line = p.stderr.readline()
if not line: break
print line.strip()
time.sleep(0.1)
This is my simplified code. Runs with no errors however when typing for raw_input() in the terminal class nothing I type appears at t开发者_如何学Che prompt. Whats wrong?
raw_input
takes the prompt text as a parameter, and defaults to an empty string. Try changing it to raw_input("input: ")
or something like that.
精彩评论