diff --git a/nox/command.py b/nox/command.py index 8a55c1fa..7ddb1da8 100644 --- a/nox/command.py +++ b/nox/command.py @@ -92,7 +92,10 @@ def run( success_codes = [0] cmd, args = args[0], args[1:] - full_cmd = f"{cmd} {_shlex_join(args)}" + try: + full_cmd = f"{cmd} {_shlex_join(args)}" + except TypeError: + full_cmd = f"{cmd} {args}" cmd_path = which(cmd, paths) diff --git a/tests/test_command.py b/tests/test_command.py index a05ab820..bd9f19ec 100644 --- a/tests/test_command.py +++ b/tests/test_command.py @@ -22,6 +22,7 @@ import subprocess import sys import time +from pathlib import Path from textwrap import dedent from unittest import mock @@ -112,6 +113,19 @@ def test_run_verbosity_failed_command(capsys, caplog): assert not logs +@pytest.mark.skipif( + platform.system() == "Windows", + reason="See https://github.com/python/cpython/issues/85815" +) +def test_run_non_str(): + result = nox.command.run( + [Path(PYTHON), "-c", "import sys; print(sys.argv)", Path(PYTHON)], + silent=True, + ) + + assert PYTHON in result + + def test_run_env_unicode(): result = nox.command.run( [PYTHON, "-c", 'import os; print(os.environ["SIGIL"])'],