def capture(self, run_info_dict):
    # Force the scm discovery logging messages to appear before ours, so the startup delay
    # is properly associated in the user's mind with us and not with scm.
    logger.info('Capturing repro information to {}'.format(self._path))
    with open_tar(self._path, 'w:gz', dereference=True, compresslevel=6) as tarout:
      for relpath in os.listdir(self._buildroot):
        if relpath not in self._ignore:
          tarout.add(os.path.join(self._buildroot, relpath), relpath)

      with temporary_file() as tmpfile:
        tmpfile.write('# Pants repro captured for the following build:\n')
        for k, v in sorted(run_info_dict.items()):
          tmpfile.write('#  {}: {}\n'.format(k, v))
        cmd_line = list(sys.argv)
        # Use 'pants' instead of whatever the full executable path was on the user's system.
        cmd_line[0] = 'pants'
        # Remove any repro-related flags. The repro-ing user won't want to call those.
        cmd_line = [x for x in cmd_line if not x.startswith('--repro-')]
        tmpfile.write("'" +"' '".join(cmd_line) + "'\n")
        tmpfile.flush()
        chmod_plus_x(tmpfile.name)
        tarout.add(tmpfile.name, 'repro.sh')
dataset/ETHPy150Open pantsbuild/pants/src/python/pants/bin/repro.py/Repro.capture/original