Skip to content

resetenv() always crashes #2068

@czerouni

Description

@czerouni

Any use of resetenv() in the commands() function results in a traceback that ends with

  File "/laika/dist/third_party/linux_rocky9_x86_64/rez/v3.3.0/lib/python3.11/site-packages/rez/shells.py", line 137, in get_output
    script = '\n'.join(self._lines) + '\n'
             ^^^^^^^^^^^^^^^^^^^^^^
TypeError: sequence item 76: expected str instance, NoneType found

This is because resetenv() is set to the return value of setenv() but setenv() doesn't return anything. And even if it did, resetenv() wouldn't do what rezconfig.py implies that it would.

Environment

  • OS rocky9.4
  • Rez version 3.3.0
  • Rez python version 3.11.12

To Reproduce

def commands():
    setenv("FOO", "value")
    resetenv("FOO", "new_value")

then build this package and do rez env <package_name>

Expected behavior
The variable 'FOO' would be reset to "new_value"

Actual behavior
Traceback as described above

Related Issues/PRs
I couldn't find any issues related to this

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions