Skip to content

Commit 427eb2b

Browse files
committed
Don't swallow errors when fg writes to stdin
1 parent cf07d5c commit 427eb2b

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
- ``supervisorctl`` commands ``avail``, ``reread``, and ``version`` now show
3535
an error message if an argument is given.
3636

37+
- Fixed a bug where ``supervisorctl fg`` would swallow most XML-RPC faults.
38+
``fg`` now prints the fault and exits.
39+
3740
3.3.1 (2016-08-02)
3841
------------------
3942

supervisor/supervisorctl.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,22 +1327,22 @@ def do_fg(self, arg):
13271327
except xmlrpclib.Fault as e:
13281328
if e.faultCode == xmlrpc.Faults.NOT_RUNNING:
13291329
self.ctl.output('Process got killed')
1330-
self.ctl.output('Exiting foreground')
1331-
a.kill()
1332-
return
1330+
else:
1331+
self.ctl.output('ERROR: ' + str(e))
1332+
self.ctl.output('Exiting foreground')
1333+
a.kill()
1334+
return
13331335

13341336
info = supervisor.getProcessInfo(name)
13351337
if info['state'] != states.ProcessStates.RUNNING:
13361338
self.ctl.output('Process got killed')
13371339
self.ctl.output('Exiting foreground')
13381340
a.kill()
13391341
return
1340-
continue
13411342
except (KeyboardInterrupt, EOFError):
1343+
self.ctl.output('Exiting foreground')
13421344
if a:
13431345
a.kill()
1344-
self.ctl.output('Exiting foreground')
1345-
return
13461346

13471347
def help_fg(self,args=None):
13481348
self.ctl.output('fg <process>\tConnect to a process in foreground mode')

0 commit comments

Comments
 (0)