do not run the urwid loop at all when not interactive

This commit is contained in:
Michael Hudson-Doyle 2020-09-16 13:06:03 +12:00
parent 45009e3a12
commit aa3bce4414
2 changed files with 8 additions and 4 deletions

View File

@ -195,6 +195,7 @@ class Subiquity(TuiApplication):
def restart(self, remove_last_screen=True):
if remove_last_screen:
self._remove_last_screen()
if self.urwid_loop is not None:
self.urwid_loop.screen.stop()
cmdline = ['snap', 'run', 'subiquity']
if self.opts.dry_run:
@ -276,7 +277,9 @@ class Subiquity(TuiApplication):
await self.load_autoinstall_config()
if not self.interactive() and not self.opts.dry_run:
open('/run/casper-no-prompt', 'w').close()
await super().start()
await super().start(start_urwid=self.interactive())
if not self.interactive():
self.select_initial_screen(0)
def extra_urwid_loop_args(self):
return dict(input_filter=self.input_filter.filter)

View File

@ -267,8 +267,9 @@ class TuiApplication(Application):
controller_index = i
return controller_index
async def start(self):
async def start(self, start_urwid=True):
await super().start()
if start_urwid:
self.start_urwid()
def run(self):