diff --git a/script-resources/common_script_utils.py b/script-resources/common_script_utils.py index 71bb093..c85e21a 100644 --- a/script-resources/common_script_utils.py +++ b/script-resources/common_script_utils.py @@ -13,7 +13,11 @@ def platform_not_supported_error() -> NoReturn: raise Exception("platform '{}' is not supported!".format(sys.platform)) -def run_chooser(choices: Iterable[str], prompt: Optional[str] = None, async_read: bool = False) -> int: +def run_chooser( + choices: Iterable[str], + prompt: Optional[str] = None, + async_read: bool = False, +) -> int: supports_result_index = True if os.isatty(sys.stderr.fileno()): process_args = [ @@ -41,7 +45,8 @@ def run_chooser(choices: Iterable[str], prompt: Optional[str] = None, async_read with chooser_process.stdin as pipe: for index, choice in enumerate(choices): - if "\n" not in choice: + + if "\n" in choice: raise Exception("choices can only span a single line") if not supports_result_index: pipe.write(str(index).encode())