vsavchenko created this revision.
vsavchenko added reviewers: NoQ, dcoughlin, xazax.hun.
Herald added subscribers: cfe-commits, ASDenysPetrov, Charusso, dkrupp, 
donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, rnkovacs, szepet, 
baloghadamsoftware.
Herald added a project: clang.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83373

Files:
  clang/utils/analyzer/SATest.py


Index: clang/utils/analyzer/SATest.py
===================================================================
--- clang/utils/analyzer/SATest.py
+++ clang/utils/analyzer/SATest.py
@@ -132,27 +132,35 @@
         pass
 
     finally:
-        print("Please wait for docker to clean up")
-        call("docker stop satest", shell=True)
+        docker_cleanup()
 
 
 def docker_run(args, command, docker_args=""):
-    return call("docker run --rm --name satest "
-                "-v {llvm}:/llvm-project "
-                "-v {build}:/build "
-                "-v {clang}:/analyzer "
-                "-v {scripts}:/scripts "
-                "-v {projects}:/projects "
-                "{docker_args} "
-                "satest-image:latest {command}"
-                .format(llvm=args.llvm_project_dir,
-                        build=args.build_dir,
-                        clang=args.clang_dir,
-                        scripts=SCRIPTS_DIR,
-                        projects=PROJECTS_DIR,
-                        docker_args=docker_args,
-                        command=command),
-                shell=True)
+    try:
+        return call("docker run --rm --name satest "
+                    "-v {llvm}:/llvm-project "
+                    "-v {build}:/build "
+                    "-v {clang}:/analyzer "
+                    "-v {scripts}:/scripts "
+                    "-v {projects}:/projects "
+                    "{docker_args} "
+                    "satest-image:latest {command}"
+                    .format(llvm=args.llvm_project_dir,
+                            build=args.build_dir,
+                            clang=args.clang_dir,
+                            scripts=SCRIPTS_DIR,
+                            projects=PROJECTS_DIR,
+                            docker_args=docker_args,
+                            command=command),
+                    shell=True)
+
+    except KeyboardInterrupt:
+        docker_cleanup()
+
+
+def docker_cleanup():
+    print("Please wait for docker to clean up")
+    call("docker stop satest", shell=True)
 
 
 def main():


Index: clang/utils/analyzer/SATest.py
===================================================================
--- clang/utils/analyzer/SATest.py
+++ clang/utils/analyzer/SATest.py
@@ -132,27 +132,35 @@
         pass
 
     finally:
-        print("Please wait for docker to clean up")
-        call("docker stop satest", shell=True)
+        docker_cleanup()
 
 
 def docker_run(args, command, docker_args=""):
-    return call("docker run --rm --name satest "
-                "-v {llvm}:/llvm-project "
-                "-v {build}:/build "
-                "-v {clang}:/analyzer "
-                "-v {scripts}:/scripts "
-                "-v {projects}:/projects "
-                "{docker_args} "
-                "satest-image:latest {command}"
-                .format(llvm=args.llvm_project_dir,
-                        build=args.build_dir,
-                        clang=args.clang_dir,
-                        scripts=SCRIPTS_DIR,
-                        projects=PROJECTS_DIR,
-                        docker_args=docker_args,
-                        command=command),
-                shell=True)
+    try:
+        return call("docker run --rm --name satest "
+                    "-v {llvm}:/llvm-project "
+                    "-v {build}:/build "
+                    "-v {clang}:/analyzer "
+                    "-v {scripts}:/scripts "
+                    "-v {projects}:/projects "
+                    "{docker_args} "
+                    "satest-image:latest {command}"
+                    .format(llvm=args.llvm_project_dir,
+                            build=args.build_dir,
+                            clang=args.clang_dir,
+                            scripts=SCRIPTS_DIR,
+                            projects=PROJECTS_DIR,
+                            docker_args=docker_args,
+                            command=command),
+                    shell=True)
+
+    except KeyboardInterrupt:
+        docker_cleanup()
+
+
+def docker_cleanup():
+    print("Please wait for docker to clean up")
+    call("docker stop satest", shell=True)
 
 
 def main():
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D83373: [analyze... Valeriy Savchenko via Phabricator via cfe-commits

Reply via email to