python3 agi send_command
parent
d81fa0ea5f
commit
386574d8ac
|
@ -105,7 +105,8 @@ class AGI:
|
||||||
def _get_agi_env(self):
|
def _get_agi_env(self):
|
||||||
while 1:
|
while 1:
|
||||||
if PY3:
|
if PY3:
|
||||||
line = self.stdin.readline().strip().decode('utf8')
|
line = self.stdin.readline().strip()
|
||||||
|
if type(line) is bytes: line = line.decode('utf8')
|
||||||
else:
|
else:
|
||||||
line = self.stdin.readline().strip()
|
line = self.stdin.readline().strip()
|
||||||
self.stderr.write('ENV LINE: ')
|
self.stderr.write('ENV LINE: ')
|
||||||
|
@ -164,7 +165,10 @@ class AGI:
|
||||||
if command[-1] != '\n':
|
if command[-1] != '\n':
|
||||||
command += '\n'
|
command += '\n'
|
||||||
self.stderr.write(' COMMAND: %s' % command)
|
self.stderr.write(' COMMAND: %s' % command)
|
||||||
self.stdout.write(command)
|
if PY3:
|
||||||
|
self.stdout.write(command.encode('utf8'))
|
||||||
|
else:
|
||||||
|
self.stdout.write(command)
|
||||||
self.stdout.flush()
|
self.stdout.flush()
|
||||||
|
|
||||||
def get_result(self, stdin=sys.stdin):
|
def get_result(self, stdin=sys.stdin):
|
||||||
|
|
Loading…
Reference in New Issue