Skip to content

Commit

Permalink
Handle garbage in environment more gracefully when setting vsenv
Browse files Browse the repository at this point in the history
Environment line may not contain '=' and thus fail to decompose into a
key/value pair.
  • Loading branch information
DFOVIT authored and nirbheek committed Aug 8, 2022
1 parent 5c2703b commit e62ae02
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions mesonbuild/mesonlib/vsenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,13 @@ def _setup_vsenv(force: bool) -> bool:
continue
if not bat_line:
continue
k, v = bat_line.split('=', 1)
os.environ[k] = v
try:
k, v = bat_line.split('=', 1)
except ValueError:
# there is no "=", ignore junk data
pass
else:
os.environ[k] = v
return True

def setup_vsenv(force: bool = False) -> bool:
Expand Down

0 comments on commit e62ae02

Please sign in to comment.