Make failing shells be handled more gracefully
This commit is contained in:
parent
57a8d94339
commit
7b52be076b
17
terminator
17
terminator
|
@ -148,7 +148,9 @@ class TerminatorTerm:
|
||||||
if not env_proxy:
|
if not env_proxy:
|
||||||
os.putenv ('http_proxy', self.conf.http_proxy)
|
os.putenv ('http_proxy', self.conf.http_proxy)
|
||||||
|
|
||||||
self.spawn_child ()
|
if self.spawn_child () == -1:
|
||||||
|
# We failed to usefully create a child shell, we need to kill ourself
|
||||||
|
gobject.timeout_add (100, self.terminator.closeterm, self)
|
||||||
|
|
||||||
def add_matches (self, lboundry="[[:<:]]", rboundry="[[:>:]]"):
|
def add_matches (self, lboundry="[[:<:]]", rboundry="[[:>:]]"):
|
||||||
userchars = "-A-Za-z0-9"
|
userchars = "-A-Za-z0-9"
|
||||||
|
@ -202,7 +204,7 @@ class TerminatorTerm:
|
||||||
if not os.path.exists (shell):
|
if not os.path.exists (shell):
|
||||||
# Give up, we're completely stuck
|
# Give up, we're completely stuck
|
||||||
print >> sys.stderr, _('Unable to find a shell')
|
print >> sys.stderr, _('Unable to find a shell')
|
||||||
exit (1)
|
return (-1)
|
||||||
|
|
||||||
if not args:
|
if not args:
|
||||||
args.append (shell)
|
args.append (shell)
|
||||||
|
@ -211,20 +213,21 @@ class TerminatorTerm:
|
||||||
|
|
||||||
if self._pid == -1:
|
if self._pid == -1:
|
||||||
print >>sys.stderr, _('Unable to start shell: ') + shell
|
print >>sys.stderr, _('Unable to start shell: ') + shell
|
||||||
exit (1)
|
return (-1)
|
||||||
|
|
||||||
def get_cwd (self):
|
def get_cwd (self):
|
||||||
""" Return the current working directory of the subprocess.
|
""" Return the current working directory of the subprocess.
|
||||||
This function requires OS specific behaviours
|
This function requires OS specific behaviours
|
||||||
"""
|
"""
|
||||||
|
cwd = None
|
||||||
system = platform.system ()
|
system = platform.system ()
|
||||||
|
|
||||||
if system == 'Linux':
|
if system == 'Linux':
|
||||||
|
try:
|
||||||
cwd = os.path.realpath ('/proc/%s/cwd' % self._pid)
|
cwd = os.path.realpath ('/proc/%s/cwd' % self._pid)
|
||||||
else:
|
except:
|
||||||
# We don't have a child cwd getter for this platform, so let
|
pass
|
||||||
# TerminatorTerm use its default
|
|
||||||
cwd = None
|
|
||||||
return (cwd)
|
return (cwd)
|
||||||
|
|
||||||
def reconfigure_vte (self):
|
def reconfigure_vte (self):
|
||||||
|
|
Loading…
Reference in New Issue