Skip to content

Commit

Permalink
使用 --json 选项时,禁用日志,防止混乱标准输出流
Browse files Browse the repository at this point in the history
  • Loading branch information
闻海钧 committed Jun 11, 2020
1 parent 350ba63 commit c951417
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pypssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ def execute(command, json, view, template):
"""
为目标批量执行命令
"""
if json:
logging.disable(50)
client = get_client()
output = client.run_command(command, stop_on_errors = False)
client.join(output)
Expand Down Expand Up @@ -199,6 +201,8 @@ def pull(remote_file, local_file):
@click.option('--json', flag_value=True, type=bool, required=False)
@click.option('--ssh-test/--no-ssh-test', default=True, type=bool)
def test(timeout, json, ssh_test):
if json:
logging.disable(50)
"""
测试端口/ssh的连通性
"""
Expand Down Expand Up @@ -266,6 +270,8 @@ def execfile(ctx, script_file, json, template, script_arg, env, attachment, work
"""
使本地脚本文件批量下发到远程执行
"""
if json:
logging.disable(50)
put_files = []
if not Path(script_file).is_file():
raise AssertionError("script_file must is file!")
Expand Down

0 comments on commit c951417

Please sign in to comment.