spawn_tor: catch OSError and wrap as ClanError
This commit is contained in:
@@ -43,6 +43,7 @@ def spawn_tor() -> Iterator[None]:
|
||||
cmd_args = ["tor", "--HardwareAccel", "1"]
|
||||
packages = ["tor"]
|
||||
cmd = nix_shell(packages, cmd_args)
|
||||
try:
|
||||
process = Popen(cmd)
|
||||
try:
|
||||
while not is_tor_running():
|
||||
@@ -55,6 +56,9 @@ def spawn_tor() -> Iterator[None]:
|
||||
process.terminate()
|
||||
process.wait()
|
||||
log.info("Tor process terminated")
|
||||
except OSError as e:
|
||||
msg = f"Failed to spawn tor process with command: {cmd}"
|
||||
raise ClanError(msg) from e
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
|
||||
Reference in New Issue
Block a user