@@ -86,9 +86,9 @@ def start(self): # pragma: no cover
8686
8787 def run (self ): # pragma: no cover
8888 self .output_handler .get (self .ctl .options .serverurl ,
89- '/logtail/%s/stdout' % self .program )
89+ '/logtail/%s/stdout' % self .program )
9090 self .error_handler .get (self .ctl .options .serverurl ,
91- '/logtail/%s/stderr' % self .program )
91+ '/logtail/%s/stderr' % self .program )
9292 asyncore .loop ()
9393
9494 def __run (self ): # pragma: no cover
@@ -1282,17 +1282,20 @@ def help_version(self):
12821282 "version\t \t \t Show the version of the remote supervisord "
12831283 "process" )
12841284
1285- def do_fg (self ,args = None ):
1285+ def do_fg (self , args = None ):
12861286 if not self .ctl .upcheck ():
12871287 return
1288+
12881289 if not args :
12891290 self .handle_error ('Error: no process name supplied' )
12901291 self .help_fg ()
12911292 return
1293+
12921294 args = args .split ()
12931295 if len (args ) > 1 :
12941296 self .handle_error ('Error: too many process names supplied' )
12951297 return
1298+
12961299 program = args [0 ]
12971300 supervisor = self .ctl .get_supervisor ()
12981301 try :
@@ -1304,18 +1307,19 @@ def do_fg(self,args=None):
13041307 # for any other fault
13051308 self .ctl .output (str (msg ))
13061309 return
1310+
13071311 if not info ['state' ] == states .ProcessStates .RUNNING :
13081312 self .handle_error ('Error: process not running' )
13091313 return
1310- # everything good; continue
1314+
13111315 a = None
13121316 try :
1313- a = fgthread (program ,self .ctl )
1314- # this thread takes care of
1315- # the output/error messages
1317+ # this thread takes care of the output/error messages
1318+ a = fgthread (program , self .ctl )
13161319 a .start ()
1320+
1321+ # this takes care of the user input
13171322 while True :
1318- # this takes care of the user input
13191323 inp = raw_input () + '\n '
13201324 try :
13211325 supervisor .sendProcessStdin (program , inp )
@@ -1325,6 +1329,7 @@ def do_fg(self,args=None):
13251329 self .ctl .output ('Exiting foreground' )
13261330 a .kill ()
13271331 return
1332+
13281333 info = supervisor .getProcessInfo (program )
13291334 if not info ['state' ] == states .ProcessStates .RUNNING :
13301335 self .ctl .output ('Process got killed' )
0 commit comments