factory.py: refactory run()
factory.py: fix run(); move connect_env.check_is_root from run_tasks_on_host() to set_connect_env()
factory.py: add open_shell(); add err_to_out=False, input=None into run(), sudo(), run_script()
factory.py: add try-except into out_loop(), err_loop()