code: def run():
      
      locale.setlocale(locale.LC_ALL, '')
      atexit.register(kill_all)
      signal.signal(signal.SIGPIPE, signal.SIG_DFL)
  
      args = parse_cmdline()
  
      args.command = find_non_interactive_command(args.command)
      args.exit_code = 0
      args.interactive = (
          not args.command
          and sys.stdin.isatty()
          and sys.stdout.isatty())
      if args.interactive:
          restore_tty_on_exit()
  
      remote_dispatcher.options = args
  
      hosts = []
      for host in args.host_names:
          hosts.extend(expand_syntax(host))
  
      dispatchers.create_remote_dispatchers(hosts)
  
      signal.signal(signal.SIGWINCH, lambda signum, frame:
                    dispatchers.update_terminal_size())
  
      stdin.the_stdin_thread = stdin.StdinThread(args.interactive)
  
      if args.profile:
          def safe_loop():
              try:
                  loop(args.interactive)
              except BaseException:
                  pass
          _profile(safe_loop)
      else:
          loop(args.interactive)
docs: Launch polysh