更新 tool.py

This commit is contained in:
xyj 2023-12-27 11:24:37 +08:00
parent 8d45809094
commit b0e63bc5b5
1 changed files with 122 additions and 122 deletions

10
tool.py
View File

@ -60,11 +60,11 @@ def exec_sh(msg, client):
client.publish(info_topic, payload=publish_payload(code=200, msg='reloading'), qos=0) client.publish(info_topic, payload=publish_payload(code=200, msg='reloading'), qos=0)
subprocess.Popen([cmd], shell=True) subprocess.Popen([cmd], shell=True)
return return
subprocess.Popen([cmd], shell=True) # subprocess.Popen([cmd], shell=True)
# p = subprocess.Popen([cmd], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) p = subprocess.Popen([cmd], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
# out, err = p.communicate() out, err = p.communicate()
# output = out.decode('utf-8').strip() output = out.decode('utf-8').strip()
# client.publish(info_topic, payload=publish_payload(code=200, msg=output), qos=0) client.publish(info_topic, payload=publish_payload(code=200, msg=output), qos=0)
def get_status(client): def get_status(client):