MCPcopy
hub / github.com/ArchiveBox/ArchiveBox / ShellError

Function ShellError

archivebox/extractors/mercury.py:27–36  ·  view source on GitHub ↗
(cmd: List[str], result: CompletedProcess, lines: int=20)

Source from the content-addressed store, hash-verified

25
26@enforce_types
27def ShellError(cmd: List[str], result: CompletedProcess, lines: int=20) -> ArchiveError:
28 # parse out last line of stderr
29 return ArchiveError(
30 f'Got {cmd[0]} response code: {result.returncode}).',
31 " ".join(
32 line.strip()
33 for line in (result.stdout + result.stderr).decode().rsplit('\n', lines)[-lines:]
34 if line.strip()
35 ),
36 )
37
38
39@enforce_types

Callers 1

save_mercuryFunction · 0.85

Calls 1

ArchiveErrorClass · 0.85

Tested by

no test coverage detected