From 7a2fe16c14111c7fea7a54bdf9a30aa4d6c603c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ernesto=20Avil=C3=A9s=20V=C3=A1zquez?= Date: Mon, 30 May 2022 11:38:45 -0700 Subject: [PATCH] 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 --- build/fbcode_builder/getdeps/platform.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build/fbcode_builder/getdeps/platform.py b/build/fbcode_builder/getdeps/platform.py index 37557c581..4d37d2872 100644 --- a/build/fbcode_builder/getdeps/platform.py +++ b/build/fbcode_builder/getdeps/platform.py @@ -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():