add: Command.receive_from_stream
This commit is contained in:
+7
-4
@@ -274,10 +274,9 @@ class ZFS:
|
||||
# -u File system that is associated with the received stream is not mounted.
|
||||
if not isinstance(pool, Pool):
|
||||
raise TypeError("Can only receive into pools.")
|
||||
# TODO use internal functions
|
||||
check_output(
|
||||
Command.receive_from_stream(
|
||||
[config.ZFS, "receive", "-d", "-F", "-u", pool.name],
|
||||
stdin=stream.stdout,
|
||||
stream,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
@@ -489,7 +488,7 @@ class Snapshot:
|
||||
|
||||
class Command:
|
||||
@staticmethod
|
||||
def run(cmdline: list[str]):
|
||||
def run(cmdline: list[str]) -> None:
|
||||
call(cmdline)
|
||||
|
||||
@staticmethod
|
||||
@@ -498,6 +497,10 @@ class Command:
|
||||
cmdline = [cmdline]
|
||||
return check_output(cmdline).strip().decode()
|
||||
|
||||
@staticmethod
|
||||
def receive_from_stream(cmdline: str | list[str], stream: Popen) -> None:
|
||||
check_output(cmdline, stdin=stream.stdout)
|
||||
|
||||
|
||||
def verify_running_as_root():
|
||||
if getuid() > 0:
|
||||
|
||||
Reference in New Issue
Block a user