don't close stdin in Popen on win32, because it
causes a TB when gajim is started from noninterractive shels like idle (fixes #1506)
This commit is contained in:
parent
1bcf3b9dc6
commit
b4b810f465
|
@ -208,7 +208,7 @@ class IdleCommand(IdleObject):
|
||||||
self.result = self.pipe.stdout.read()
|
self.result = self.pipe.stdout.read()
|
||||||
self._return_result()
|
self._return_result()
|
||||||
self.pipe.stdout.close()
|
self.pipe.stdout.close()
|
||||||
|
self.pipe.stdin.close()
|
||||||
def start(self):
|
def start(self):
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
self._start_nt()
|
self._start_nt()
|
||||||
|
@ -220,16 +220,19 @@ class IdleCommand(IdleObject):
|
||||||
self.result = ''
|
self.result = ''
|
||||||
self._return_result()
|
self._return_result()
|
||||||
return
|
return
|
||||||
|
# if gajim is started from noninteraactive shells stdin is closed and
|
||||||
|
# cannot be forwarded, so we have to keep it open
|
||||||
self.pipe = Popen(self._compose_command_args(), stdout=PIPE,
|
self.pipe = Popen(self._compose_command_args(), stdout=PIPE,
|
||||||
bufsize = 1024, shell = True, stderr = STDOUT, stdin = None)
|
bufsize = 1024, shell = True, stderr = STDOUT, stdin = PIPE)
|
||||||
if self.commandtimeout >= 0:
|
if self.commandtimeout >= 0:
|
||||||
self.endtime = self.idlequeue.current_time()
|
self.endtime = self.idlequeue.current_time()
|
||||||
self.idlequeue.set_alarm(self.wait_child, 0.1)
|
self.idlequeue.set_alarm(self.wait_child, 0.1)
|
||||||
|
|
||||||
def _start_posix(self):
|
def _start_posix(self):
|
||||||
self.pipe = os.popen(self._compose_command_line())
|
write_d, self.pipe = os.popen4(self._compose_command_line())
|
||||||
|
write_d.close()
|
||||||
self.fd = self.pipe.fileno()
|
self.fd = self.pipe.fileno()
|
||||||
fcntl.fcntl(self.pipe, fcntl.F_SETFL, os.O_NONBLOCK)
|
#~ fcntl.fcntl(self.pipe, fcntl.F_SETFL, os.O_NONBLOCK)
|
||||||
self.idlequeue.plug_idle(self, False, True)
|
self.idlequeue.plug_idle(self, False, True)
|
||||||
if self.commandtimeout >= 0:
|
if self.commandtimeout >= 0:
|
||||||
self.idlequeue.set_read_timeout(self.fd, self.commandtimeout)
|
self.idlequeue.set_read_timeout(self.fd, self.commandtimeout)
|
||||||
|
|
Loading…
Reference in New Issue