diff --git a/lldb/utils/lldb-repro/lldb-repro.py b/lldb/utils/lldb-repro/lldb-repro.py index 313d3855a02..f7bcd3baa7a 100755 --- a/lldb/utils/lldb-repro/lldb-repro.py +++ b/lldb/utils/lldb-repro/lldb-repro.py @@ -43,8 +43,10 @@ def main(): # Create a new lldb invocation with capture or replay enabled. lldb = os.path.join(os.path.dirname(sys.argv[0]), 'lldb') new_args = [lldb] + cleanup = False if sys.argv[1] == "replay": new_args.extend(['--replay', reproducer_path]) + cleanup = True elif sys.argv[1] == "capture": new_args.extend([ '--capture', '--capture-path', reproducer_path, @@ -55,7 +57,10 @@ def main(): help() return 1 - return subprocess.call(new_args) + exit_code = subprocess.call(new_args) + if cleanup: + shutil.rmtree(reproducer_path, True) + return exit_code if __name__ == '__main__':