Add timeout and use text mode
parent
894a6a6504
commit
0a6853964f
|
@ -30,10 +30,17 @@ Report: {DESC}
|
||||||
msg["From"] = "crossfire"
|
msg["From"] = "crossfire"
|
||||||
msg["Subject"] = "Crossfire issue report"
|
msg["Subject"] = "Crossfire issue report"
|
||||||
|
|
||||||
result = subprocess.run(['sendmail', recipient], input=msg.as_bytes())
|
try:
|
||||||
if result.returncode == 0:
|
result = subprocess.run(['sendmail', recipient], universal_newlines=True, input=msg.as_string(), timeout=2)
|
||||||
pl.Message("Thank you for your report.")
|
if result.returncode == 0:
|
||||||
else:
|
pl.Message("Thank you for your report.")
|
||||||
pl.Message("There was an error reporting your problem. Please contact a Dungeon Master to report your problem.")
|
else:
|
||||||
|
error(pl)
|
||||||
|
except subprocess.TimeoutExpired:
|
||||||
|
error(pl)
|
||||||
|
Crossfire.Log(Crossfire.LogError, "Timed out while reporting a problem")
|
||||||
|
|
||||||
|
def error(pl):
|
||||||
|
pl.Message("There was an error reporting your problem. Please try again or contact a Dungeon Master to report your problem.")
|
||||||
|
|
||||||
report(Crossfire.WhoAmI())
|
report(Crossfire.WhoAmI())
|
||||||
|
|
Loading…
Reference in New Issue