update
This commit is contained in:
parent
c8494ddcb4
commit
744f1eb524
|
|
@ -34,6 +34,9 @@ def execShell(cmdstring, cwd=None, timeout=None, shell=True):
|
|||
if end_time <= datetime.datetime.now():
|
||||
raise Exception("Timeout:%s" % cmdstring)
|
||||
|
||||
if sys.version_info[0] == 2:
|
||||
return sub.communicate()
|
||||
|
||||
data = sub.communicate()
|
||||
# python3 fix 返回byte数据
|
||||
if isinstance(data[0], bytes):
|
||||
|
|
|
|||
|
|
@ -208,8 +208,10 @@ class plugins_api:
|
|||
data = self.run(name, func, version, args, script)
|
||||
if data[1] == '':
|
||||
r = mw.returnJson(True, "OK", data[0].strip())
|
||||
r = mw.returnJson(False, data[1].strip())
|
||||
else:
|
||||
r = mw.returnJson(False, data[1].strip())
|
||||
|
||||
print('runApi', r)
|
||||
return r
|
||||
|
||||
def callbackApi(self):
|
||||
|
|
@ -794,17 +796,10 @@ class plugins_api:
|
|||
|
||||
if mw.isAppleSystem():
|
||||
print('run', py_cmd)
|
||||
print(data)
|
||||
# print os.path.exists(py_cmd)
|
||||
|
||||
t1 = ''
|
||||
t2 = ''
|
||||
if isinstance(data[1], bytes):
|
||||
t1 = str(data[1], encoding='utf-8')
|
||||
|
||||
if isinstance(data[0], bytes):
|
||||
t2 = str(data[0], encoding='utf-8')
|
||||
|
||||
return (t1.strip(), t2.strip())
|
||||
return (data[0].strip(), data[1].strip())
|
||||
|
||||
# 映射包调用
|
||||
def callback(self, name, func, args='', script='index'):
|
||||
|
|
|
|||
|
|
@ -282,28 +282,28 @@ def errorLogPath():
|
|||
if __name__ == "__main__":
|
||||
func = sys.argv[1]
|
||||
if func == 'status':
|
||||
print status()
|
||||
print(status())
|
||||
elif func == 'start':
|
||||
print start()
|
||||
print(start())
|
||||
elif func == 'stop':
|
||||
print stop()
|
||||
print(stop())
|
||||
elif func == 'restart':
|
||||
print restart()
|
||||
print(restart())
|
||||
elif func == 'reload':
|
||||
print reload()
|
||||
print(reload())
|
||||
elif func == 'initd_status':
|
||||
print initdStatus()
|
||||
print(initdStatus())
|
||||
elif func == 'initd_install':
|
||||
print initdInstall()
|
||||
print(initdInstall())
|
||||
elif func == 'initd_uninstall':
|
||||
print initdUinstall()
|
||||
print(initdUinstall())
|
||||
elif func == 'conf':
|
||||
print getConf()
|
||||
print(getConf())
|
||||
elif func == 'get_os':
|
||||
print getOs()
|
||||
print(getOs())
|
||||
elif func == 'run_info':
|
||||
print runInfo()
|
||||
print(runInfo())
|
||||
elif func == 'error_log':
|
||||
print errorLogPath()
|
||||
print(errorLogPath())
|
||||
else:
|
||||
print 'error'
|
||||
print('error')
|
||||
|
|
|
|||
Loading…
Reference in New Issue