diff --git a/script-resources/common_script_utils.py b/script-resources/common_script_utils.py index c85e21a..71bb093 100644 --- a/script-resources/common_script_utils.py +++ b/script-resources/common_script_utils.py @@ -13,11 +13,7 @@ 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 = [ @@ -45,8 +41,7 @@ def run_chooser( with chooser_process.stdin as pipe: for index, choice in enumerate(choices): - - if "\n" in choice: + if "\n" not in choice: raise Exception("choices can only span a single line") if not supports_result_index: pipe.write(str(index).encode())