fix bc bug
This commit is contained in:
parent
8087c72cb4
commit
212d47b93f
1 changed files with 4 additions and 7 deletions
11
worker/bc.py
11
worker/bc.py
|
@ -365,13 +365,10 @@ def funMain (ch):
|
||||||
|
|
||||||
def sysbc (arg):
|
def sysbc (arg):
|
||||||
try:
|
try:
|
||||||
arg = "echo \"" + arg + "\" | bc"
|
arg = arg.replace("\'", "")
|
||||||
ret = subprocess.run(arg, shell = True, stdout = subprocess.PIPE, stderr = subprocess.STDOUT, check = True, timeout = 2)
|
arg = "echo \'\'\'" + arg + "\'\'\' | bc"
|
||||||
retmes = str(ret.stdout)
|
ret = subprocess.run(arg, shell = True, stdout = subprocess.PIPE, stderr = subprocess.STDOUT, check = True, timeout = 1)
|
||||||
retmes = retmes[2:len(retmes)-3]
|
return bytes.decode(ret.stdout).replace("\n", "")
|
||||||
retmes = retmes.replace('\\n', ". ")
|
|
||||||
retmes = retmes.replace('\\', "")
|
|
||||||
return retmes
|
|
||||||
except subprocess.TimeoutExpired:
|
except subprocess.TimeoutExpired:
|
||||||
return "你干了啥怎么半天算不完啦!服务器爆了打你哦~"
|
return "你干了啥怎么半天算不完啦!服务器爆了打你哦~"
|
||||||
except:
|
except:
|
||||||
|
|
Loading…
Reference in a new issue