更新 tool.py
This commit is contained in:
parent
8d45809094
commit
b0e63bc5b5
10
tool.py
10
tool.py
|
@ -60,11 +60,11 @@ def exec_sh(msg, client):
|
|||
client.publish(info_topic, payload=publish_payload(code=200, msg='reloading'), qos=0)
|
||||
subprocess.Popen([cmd], shell=True)
|
||||
return
|
||||
subprocess.Popen([cmd], shell=True)
|
||||
# p = subprocess.Popen([cmd], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
# out, err = p.communicate()
|
||||
# output = out.decode('utf-8').strip()
|
||||
# client.publish(info_topic, payload=publish_payload(code=200, msg=output), qos=0)
|
||||
# subprocess.Popen([cmd], shell=True)
|
||||
p = subprocess.Popen([cmd], shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
out, err = p.communicate()
|
||||
output = out.decode('utf-8').strip()
|
||||
client.publish(info_topic, payload=publish_payload(code=200, msg=output), qos=0)
|
||||
|
||||
|
||||
def get_status(client):
|
||||
|
|
Loading…
Reference in New Issue