loud-laptop-17949
11/12/2021, 11:04 PMos.uname()
–
def _syscmd_uname(option, default=''):
""" Interface to the system's uname command.
"""
if sys.platform in ('dos', 'win32', 'win16'):
# XXX Others too ?
return default
try:
f = os.popen('uname %s 2> %s' % (option, DEV_NULL))
except (AttributeError, OSError):
return default
> output = f.read().strip()
E ValueError: I/O operation on closed file.
/Users/ryan.king/.asdf/installs/python/3.6.15/lib/python3.6/platform.py:791: ValueError
This code works fine outside pants and I don't know what about it would fail in the pants env.polite-garden-50641
11/12/2021, 11:32 PMwitty-crayon-22786
11/13/2021, 12:07 AMuname
directly in your test, and rendering its output to see what it is missingloud-laptop-17949
11/13/2021, 12:22 AMwitty-crayon-22786
11/13/2021, 12:23 AMHOME
or USER
), and some tools can become … confused by that.$ env -i uname
Darwin
uname
at all without PATH
PATH
through with https://www.pantsbuild.org/docs/reference-test#section-extra-env-vars, or change the testloud-laptop-17949
11/13/2021, 12:29 AMenough-analyst-54434
11/13/2021, 12:42 AMos.uname
, presumably, does not shell out. The code you reference shells out and needs to 1st find a shell, then find uname, the binary.witty-crayon-22786
11/13/2021, 12:42 AMf = os.popen('uname %s 2> %s' % (option, DEV_NULL))
loud-laptop-17949
11/15/2021, 7:15 PM