(archive, cache, fso)
| 48 | matcher.add_inclexcl(args.patterns) |
| 49 | |
| 50 | def create_inner(archive, cache, fso): |
| 51 | # Add cache dir to inode_skip list |
| 52 | skip_inodes = set() |
| 53 | try: |
| 54 | st = os.stat(get_cache_dir()) |
| 55 | skip_inodes.add((st.st_ino, st.st_dev)) |
| 56 | except OSError: |
| 57 | pass |
| 58 | # Add local repository dir to inode_skip list |
| 59 | if not args.location.host: |
| 60 | try: |
| 61 | st = os.stat(args.location.path) |
| 62 | skip_inodes.add((st.st_ino, st.st_dev)) |
| 63 | except OSError: |
| 64 | pass |
| 65 | logger.debug("Processing files ...") |
| 66 | if args.content_from_command: |
| 67 | path = args.stdin_name |
| 68 | mode = args.stdin_mode |
| 69 | user = args.stdin_user |
| 70 | group = args.stdin_group |
| 71 | if not dry_run: |
| 72 | try: |
| 73 | try: |
| 74 | env = prepare_subprocess_env(system=True) |
| 75 | proc = subprocess.Popen( # nosec B603 |
| 76 | args.paths, |
| 77 | stdout=subprocess.PIPE, |
| 78 | env=env, |
| 79 | preexec_fn=None if is_win32 else ignore_sigint, |
| 80 | ) |
| 81 | except (FileNotFoundError, PermissionError) as e: |
| 82 | raise CommandError(f"Failed to execute command: {e}") |
| 83 | status = fso.process_pipe( |
| 84 | path=path, cache=cache, fd=proc.stdout, mode=mode, user=user, group=group |
| 85 | ) |
| 86 | rc = proc.wait() |
| 87 | if rc != 0: |
| 88 | raise CommandError(f"Command {args.paths[0]!r} exited with status {rc}") |
| 89 | except BackupError as e: |
| 90 | raise Error(f"{path!r}: {e}") |
| 91 | else: |
| 92 | status = "+" # included |
| 93 | self.print_file_status(status, path) |
| 94 | elif args.paths_from_command or args.paths_from_shell_command or args.paths_from_stdin: |
| 95 | paths_sep = eval_escapes(args.paths_delimiter) if args.paths_delimiter is not None else "\n" |
| 96 | if args.paths_from_command or args.paths_from_shell_command: |
| 97 | try: |
| 98 | env = prepare_subprocess_env(system=True) |
| 99 | if args.paths_from_shell_command: |
| 100 | # Use shell=True to support pipes, redirection, etc. |
| 101 | shell = True |
| 102 | cmd = " ".join(args.paths) |
| 103 | else: |
| 104 | shell = False |
| 105 | cmd = args.paths |
| 106 | proc = subprocess.Popen( |
| 107 | cmd, |
nothing calls this directly
no test coverage detected