1
0
mirror of https://github.com/facebook/proxygen.git synced 2025-08-07 07:02:53 +03:00

Fix return type in get_linux_type() (#1025)

Summary:
This function is expected to return a tuple of 3 elements. This doesn't happen when it fails opening the `/etc/os-release` file.

X-link: https://github.com/facebook/watchman/pull/1025

Reviewed By: fanzeyi

Differential Revision: D36736667

Pulled By: chadaustin

fbshipit-source-id: a6839235d6c5ebb50267cd78f1c9590b2fb180d7
This commit is contained in:
Ernesto Avilés Vázquez
2022-05-30 11:38:45 -07:00
committed by Facebook GitHub Bot
parent eb2bfee04c
commit 7a2fe16c14

View File

@@ -7,6 +7,7 @@ import platform
import re
import shlex
import sys
from typing import Optional, Tuple
def is_windows() -> bool:
@@ -15,12 +16,12 @@ def is_windows() -> bool:
return sys.platform.startswith("win")
def get_linux_type():
def get_linux_type() -> Tuple[Optional[str], Optional[str], Optional[str]]:
try:
with open("/etc/os-release") as f:
data = f.read()
except EnvironmentError:
return (None, None)
return (None, None, None)
os_vars = {}
for line in data.splitlines():