We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents b5762b1 + 7d21e4f commit 762b283Copy full SHA for 762b283
dephell_setuptools/_pkginfo.py
@@ -17,6 +17,15 @@ def content(self) -> Dict[str, Any]:
17
cmd = ['pkginfo', '--json', str(self.path)]
18
result = subprocess.run(cmd, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
19
if result.returncode != 0:
20
- raise RuntimeError(result.stderr.decode().split('\n')[-1])
21
- content = json.loads(result.stdout.decode())
+ msg_lines = result.stderr.decode().rstrip().split('\n')
+ raise RuntimeError(msg_lines[-1] if msg_lines else 'Unknown error')
22
+ stdout = result.stdout.decode()
23
+ if not stdout:
24
+ return {}
25
+
26
+ try:
27
+ content = json.loads(stdout)
28
+ except json.decoder.JSONDecodeError:
29
30
31
return self._clean(content)
0 commit comments