![]() ![]() That is the point of setting the empty string as default value for known environment vars in the first place, and it ought to be extended to unknown environ vars as well. WTF?īut the larger issue remains: user has every right to expect that reference to undefined environment in subproc mode should evaluate to empty string, not raise KeyError. It has the expected value when I run the test now. You're right, I cannot repro the missing WINDIR now. $ANSICON is a variable with default defined by Xonsh: This might be acceptable for variables that xonsh defines and consumes, but is clearly a lie for environment variables that other programs are supposed to define for xonsh. Xonsh environment returns a value to python code when the OS environment value is not defined. Accessing undefined variables is in my opinion always a bug regardless of the execution mode. ![]() Reference to an undefined (xonsh) environment variable should evaluate to empty string at least in subproc mode. Also the code below seems to prove this is wrong. (Case 4 but also Case 2)įor me, the above statement is clearly false. OS environment variables that don't happen to match a key in _VARS are not present in xonsh.env and $. And we'd return the defined default for references to undefined environment variables that had them and hard code empty string for other undefined variables. We might be able to fix the rest of the cases (and resolve #3703) if we implement an is-defined function so code that cares about it can tell whether it was really defined. We can address case 4 by simply ensuring all the OS environment variables are loaded into Xonsh at startup. (case 5, issue of settitle() corrupts prompt in Windows Terminal and cmd.exe #3703). Xonsh environment returns a value to python code when the OS environment value is not defined.Reference to an undefined (xonsh) environment variable should evaluate to empty string at least in subproc mode.OS environment variables that don't happen to match a key in _VARS are not present in _xonsh_.env and $.# Expected 2nd to be False if first is False (issue #3703) # Case 5: not defined in OS environment but not a Xonsh configuration parameter Ls: cannot access '$WINDIR': No such file or directory # Case 4: defined in OS environment, but not in Xonsh environment Ls: cannot access 'prompt_toolkit': No such file or directory # Case 3: defined in Xonsh environ (and synced to OS environ) Ls: cannot access '$NO_SUCH_VARIABLE': No such file or directory # Case 2: not defined in OS environ or Xonsh # As expected (but only because ANSICON has defined default of ``). Ls: cannot access '': No such file or directory # Case 1: not defined in OS environ, but Xonsh has a known default Notifying these 3 because they all touched the pkg system: "x86_64-linux" I added xonsh to environment.systemPackages because I wanted to play around with it before setting it as login shell. nix/store/z65l1jqvxa58zzwwa3bvglb6asj4y8cv-python3-3.8.5/bin/python3.8: Error while finding module specification for 'xonsh.webconfig' (ModuleNotFoundError: No module named 'xonsh') W = _make_flat_wiz(make_envvar, sorted(builtins._xonsh_.env._docs.keys()))ĪttributeError: 'Env' object has no attribute '_docs' ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |