Skip to content

Commit

Permalink
Fix IndexError. Fixes #76.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Jun 27, 2023
1 parent f857908 commit 4dd6a96
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pip_run/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def _ensure_remove_prefix(text: str, prefix: str) -> str:
return rest


@suppress(KeyError, ValueError)
@suppress(IndexError, ValueError)
def _strip_bang(params):
"""
Strip a literal `!` from the first parameter or return None.
Expand All @@ -99,6 +99,8 @@ def infer_cmd(params):
['...', 'a.py', 'param1']
>>> infer_cmd(['!an-exe', 'param1'])
['an-exe', 'param1']
>>> infer_cmd([]) == [sys.executable]
True
"""
return _strip_bang(params) or [sys.executable] + params

Expand Down

0 comments on commit 4dd6a96

Please sign in to comment.