aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/srtgui/views.py13
1 files changed, 4 insertions, 9 deletions
diff --git a/lib/srtgui/views.py b/lib/srtgui/views.py
index 6532dbe1..088a716d 100644
--- a/lib/srtgui/views.py
+++ b/lib/srtgui/views.py
@@ -1654,15 +1654,10 @@ def xhr_investigation_commit(request):
try:
cmd_list = SrtSetting.objects.get(name='SRTOOL_DEFECT_ADD').value.split(' ')
cmd_list.append(query)
- returncode, stdout, stderr = run(cmd_list, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- if 0 == returncode:
- defect = Defect.objects.get(name=query)
- else:
- _log("ERROR:submit-attachdefect:%s:STDOUT='%s':STDERR='%s':" % (returncode,stdout,stderr))
- defect = None
- return HttpResponse(json.dumps({"error":stderr + "\n"}), content_type = "application/json")
- except Exception as e:
- _log("xhr_investigation_commit:Error in defect attach query:(%s)\n" % e)
+ subprocess.check_output(cmd_list, stderr=subprocess.STDOUT, universal_newlines=True)
+ defect = Defect.objects.get(name=query)
+ except subprocess.CalledProcessError as e:
+ _log("ERROR:submit-attachdefect:%d:STDOUT='%s':" % (e.returncode, e.output))
return HttpResponse(json.dumps({"error":str(e) + "\n"}), content_type = "application/json")
if defect:
InvestigationToDefect.objects.get_or_create(investigation_id=invst_id, defect_id=defect.id, product_id=product_id)