summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2022-11-01 21:33:59 +0100
committerGregor Kleen <gkleen@yggdrasil.li>2022-11-01 21:33:59 +0100
commit234eab10a84e7ffb8bbc32f5e2f94495d3c9aedd (patch)
tree5f58f8a48dfe7efb080adb0a6f9f432bb6615852
parentf38b1c49d17fe0ca3c9c381667e36d7ade32562f (diff)
downloadnixos-234eab10a84e7ffb8bbc32f5e2f94495d3c9aedd.tar
nixos-234eab10a84e7ffb8bbc32f5e2f94495d3c9aedd.tar.gz
nixos-234eab10a84e7ffb8bbc32f5e2f94495d3c9aedd.tar.bz2
nixos-234eab10a84e7ffb8bbc32f5e2f94495d3c9aedd.tar.xz
nixos-234eab10a84e7ffb8bbc32f5e2f94495d3c9aedd.zip
...
-rw-r--r--hosts/vidhar/borg/borgsnap/borgsnap/__main__.py6
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