|
|
|
@ -62,8 +62,11 @@ def _guess_mime(data):
|
|
|
|
|
"--brief", |
|
|
|
|
"--mime-type", |
|
|
|
|
"-"], env={"LANG": 'C'}, stdin=subprocess.PIPE, stdout=subprocess.PIPE) as p: |
|
|
|
|
p.stdin.write(data.encode() if isinstance(data, str) else data) |
|
|
|
|
p.stdin.close() |
|
|
|
|
try: |
|
|
|
|
p.stdin.write(data.encode() if isinstance(data, str) else data) |
|
|
|
|
p.stdin.close() |
|
|
|
|
except BrokenPipeError: |
|
|
|
|
pass |
|
|
|
|
p.wait() |
|
|
|
|
if p.returncode == 0: |
|
|
|
|
return p.stdout.read().decode('utf-8', 'replace').strip() |
|
|
|
|