diff options
Diffstat (limited to 'hosts/vidhar/borg')
-rw-r--r-- | hosts/vidhar/borg/borgsnap/borgsnap/__main__.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/hosts/vidhar/borg/borgsnap/borgsnap/__main__.py b/hosts/vidhar/borg/borgsnap/borgsnap/__main__.py index fb206e33..15bf50c8 100644 --- a/hosts/vidhar/borg/borgsnap/borgsnap/__main__.py +++ b/hosts/vidhar/borg/borgsnap/borgsnap/__main__.py | |||
@@ -262,6 +262,8 @@ def create(*, snapshot, target, archive_prefix, dry_run): | |||
262 | 262 | ||
263 | with subprocess.Popen(create_args, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env, preexec_fn=lambda: as_borg(caps={Cap.DAC_READ_SEARCH}), cwd=dir, text=True) as proc: | 263 | with subprocess.Popen(create_args, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env, preexec_fn=lambda: as_borg(caps={Cap.DAC_READ_SEARCH}), cwd=dir, text=True) as proc: |
264 | proc_logger = logger.getChild('borg') | 264 | proc_logger = logger.getChild('borg') |
265 | stdout_logger = proc_logger.getChild('stdout') | ||
266 | stderr_logger = proc_logger.getChild('stderr') | ||
265 | 267 | ||
266 | poll = select.poll() | 268 | poll = select.poll() |
267 | poll.register(proc.stdout, select.POLLIN | select.POLLHUP) | 269 | poll.register(proc.stdout, select.POLLIN | select.POLLHUP) |
@@ -274,11 +276,11 @@ def create(*, snapshot, target, archive_prefix, dry_run): | |||
274 | if rfd == proc.stdout.fileno(): | 276 | if rfd == proc.stdout.fileno(): |
275 | line = proc.stdout.readline() | 277 | line = proc.stdout.readline() |
276 | if len(line) > 0: | 278 | if len(line) > 0: |
277 | proc_logger.info(line[:-1]) | 279 | stdout_logger.info(line[:-1]) |
278 | if rfd == proc.stderr.fileno(): | 280 | if rfd == proc.stderr.fileno(): |
279 | line = proc.stderr.readline() | 281 | line = proc.stderr.readline() |
280 | if len(line) > 0: | 282 | if len(line) > 0: |
281 | proc_logger.info(line[:-1]) | 283 | stderr_logger.info(line[:-1]) |
282 | if event & select.POLLHUP: | 284 | if event & select.POLLHUP: |
283 | poll.unregister(rfd) | 285 | poll.unregister(rfd) |
284 | pollc -= 1 | 286 | pollc -= 1 |