We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
`virtualenv --version` prints spurious error as of 20.0.24
**Issue**

When running `virtualenv --version`, a logger error is printed to stderr, though the return code is still 0.

**Environment**

Tested with Python 3.7 and 3.8, virtualenvs managed with pipenv
Ubuntu 18.04 on WSL

```
$ rm-rf tmp && mkdir tmp && cd tmp
$ pipenv install "virtualenv==20.0.23"
$ pipenv run virtualenv --version
virtualenv 20.0.23 from tmp/.venv/lib/python3.7/site-packages/virtualenv/__init__.py

$ rm-rf tmp && mkdir tmp && cd tmp
$ pipenv install "virtualenv==20.0.24"
$ pipenv run virtualenv --version
virtualenv 20.0.24 from tmp/.venv/lib/python3.7/site-packages/virtualenv/__init__.py
ERROR:root:SystemExit: 0
$ pipenv run virtualenv --version > /dev/null
ERROR:root:SystemExit: 0
$ echo $?
0
```

Nothing else is printed with `-vvv --with-traceback`

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/virtualenv/__main__.py`
Content:
```
1 from __future__ import absolute_import, print_function, unicode_literals
2 
3 import logging
4 import os
5 import sys
6 from datetime import datetime
7 
8 
9 def run(args=None, options=None):
10     start = datetime.now()
11     from virtualenv.util.error import ProcessCallFailed
12     from virtualenv.run import cli_run
13 
14     if args is None:
15         args = sys.argv[1:]
16     try:
17         session = cli_run(args, options)
18         logging.warning(LogSession(session, start))
19     except ProcessCallFailed as exception:
20         print("subprocess call failed for {} with code {}".format(exception.cmd, exception.code))
21         print(exception.out, file=sys.stdout, end="")
22         print(exception.err, file=sys.stderr, end="")
23         raise SystemExit(exception.code)
24 
25 
26 class LogSession(object):
27     def __init__(self, session, start):
28         self.session = session
29         self.start = start
30 
31     def __str__(self):
32         from virtualenv.util.six import ensure_text
33 
34         spec = self.session.creator.interpreter.spec
35         elapsed = (datetime.now() - self.start).total_seconds() * 1000
36         lines = [
37             "created virtual environment {} in {:.0f}ms".format(spec, elapsed),
38             "  creator {}".format(ensure_text(str(self.session.creator))),
39         ]
40         if self.session.seeder.enabled:
41             lines += (
42                 "  seeder {}".format(ensure_text(str(self.session.seeder))),
43                 "    added seed packages: {}".format(
44                     ", ".join(
45                         sorted(
46                             "==".join(i.stem.split("-"))
47                             for i in self.session.creator.purelib.iterdir()
48                             if i.suffix == ".dist-info"
49                         ),
50                     ),
51                 ),
52             )
53         if self.session.activators:
54             lines.append("  activators {}".format(",".join(i.__class__.__name__ for i in self.session.activators)))
55         return os.linesep.join(lines)
56 
57 
58 def run_with_catch(args=None):
59     from virtualenv.config.cli.parser import VirtualEnvOptions
60 
61     options = VirtualEnvOptions()
62     try:
63         run(args, options)
64     except (KeyboardInterrupt, SystemExit, Exception) as exception:
65         try:
66             if getattr(options, "with_traceback", False):
67                 raise
68             else:
69                 logging.error("%s: %s", type(exception).__name__, exception)
70                 code = exception.code if isinstance(exception, SystemExit) else 1
71                 sys.exit(code)
72         finally:
73             logging.shutdown()  # force flush of log messages before the trace is printed
74 
75 
76 if __name__ == "__main__":  # pragma: no cov
77     run_with_catch()  # pragma: no cov
78
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/src/virtualenv/__main__.py b/src/virtualenv/__main__.py
--- a/src/virtualenv/__main__.py
+++ b/src/virtualenv/__main__.py
@@ -66,7 +66,8 @@
             if getattr(options, "with_traceback", False):
                 raise
             else:
-                logging.error("%s: %s", type(exception).__name__, exception)
+                if not (isinstance(exception, SystemExit) and exception.code == 0):
+                    logging.error("%s: %s", type(exception).__name__, exception)
                 code = exception.code if isinstance(exception, SystemExit) else 1
                 sys.exit(code)
         finally:

{"golden_diff": "diff --git a/src/virtualenv/__main__.py b/src/virtualenv/__main__.py\n--- a/src/virtualenv/__main__.py\n+++ b/src/virtualenv/__main__.py\n@@ -66,7 +66,8 @@\n             if getattr(options, \"with_traceback\", False):\n                 raise\n             else:\n-                logging.error(\"%s: %s\", type(exception).__name__, exception)\n+                if not (isinstance(exception, SystemExit) and exception.code == 0):\n+                    logging.error(\"%s: %s\", type(exception).__name__, exception)\n                 code = exception.code if isinstance(exception, SystemExit) else 1\n                 sys.exit(code)\n         finally:\n", "issue": "`virtualenv --version` prints spurious error as of 20.0.24\n**Issue**\r\n\r\nWhen running `virtualenv --version`, a logger error is printed to stderr, though the return code is still 0.\r\n\r\n**Environment**\r\n\r\nTested with Python 3.7 and 3.8, virtualenvs managed with pipenv\r\nUbuntu 18.04 on WSL\r\n\r\n```\r\n$ rm-rf tmp && mkdir tmp && cd tmp\r\n$ pipenv install \"virtualenv==20.0.23\"\r\n$ pipenv run virtualenv --version\r\nvirtualenv 20.0.23 from tmp/.venv/lib/python3.7/site-packages/virtualenv/__init__.py\r\n\r\n$ rm-rf tmp && mkdir tmp && cd tmp\r\n$ pipenv install \"virtualenv==20.0.24\"\r\n$ pipenv run virtualenv --version\r\nvirtualenv 20.0.24 from tmp/.venv/lib/python3.7/site-packages/virtualenv/__init__.py\r\nERROR:root:SystemExit: 0\r\n$ pipenv run virtualenv --version > /dev/null\r\nERROR:root:SystemExit: 0\r\n$ echo $?\r\n0\r\n```\r\n\r\nNothing else is printed with `-vvv --with-traceback`\n", "before_files": [{"content": "from __future__ import absolute_import, print_function, unicode_literals\n\nimport logging\nimport os\nimport sys\nfrom datetime import datetime\n\n\ndef run(args=None, options=None):\n    start = datetime.now()\n    from virtualenv.util.error import ProcessCallFailed\n    from virtualenv.run import cli_run\n\n    if args is None:\n        args = sys.argv[1:]\n    try:\n        session = cli_run(args, options)\n        logging.warning(LogSession(session, start))\n    except ProcessCallFailed as exception:\n        print(\"subprocess call failed for {} with code {}\".format(exception.cmd, exception.code))\n        print(exception.out, file=sys.stdout, end=\"\")\n        print(exception.err, file=sys.stderr, end=\"\")\n        raise SystemExit(exception.code)\n\n\nclass LogSession(object):\n    def __init__(self, session, start):\n        self.session = session\n        self.start = start\n\n    def __str__(self):\n        from virtualenv.util.six import ensure_text\n\n        spec = self.session.creator.interpreter.spec\n        elapsed = (datetime.now() - self.start).total_seconds() * 1000\n        lines = [\n            \"created virtual environment {} in {:.0f}ms\".format(spec, elapsed),\n            \"  creator {}\".format(ensure_text(str(self.session.creator))),\n        ]\n        if self.session.seeder.enabled:\n            lines += (\n                \"  seeder {}\".format(ensure_text(str(self.session.seeder))),\n                \"    added seed packages: {}\".format(\n                    \", \".join(\n                        sorted(\n                            \"==\".join(i.stem.split(\"-\"))\n                            for i in self.session.creator.purelib.iterdir()\n                            if i.suffix == \".dist-info\"\n                        ),\n                    ),\n                ),\n            )\n        if self.session.activators:\n            lines.append(\"  activators {}\".format(\",\".join(i.__class__.__name__ for i in self.session.activators)))\n        return os.linesep.join(lines)\n\n\ndef run_with_catch(args=None):\n    from virtualenv.config.cli.parser import VirtualEnvOptions\n\n    options = VirtualEnvOptions()\n    try:\n        run(args, options)\n    except (KeyboardInterrupt, SystemExit, Exception) as exception:\n        try:\n            if getattr(options, \"with_traceback\", False):\n                raise\n            else:\n                logging.error(\"%s: %s\", type(exception).__name__, exception)\n                code = exception.code if isinstance(exception, SystemExit) else 1\n                sys.exit(code)\n        finally:\n            logging.shutdown()  # force flush of log messages before the trace is printed\n\n\nif __name__ == \"__main__\":  # pragma: no cov\n    run_with_catch()  # pragma: no cov\n", "path": "src/virtualenv/__main__.py"}], "after_files": [{"content": "from __future__ import absolute_import, print_function, unicode_literals\n\nimport logging\nimport os\nimport sys\nfrom datetime import datetime\n\n\ndef run(args=None, options=None):\n    start = datetime.now()\n    from virtualenv.util.error import ProcessCallFailed\n    from virtualenv.run import cli_run\n\n    if args is None:\n        args = sys.argv[1:]\n    try:\n        session = cli_run(args, options)\n        logging.warning(LogSession(session, start))\n    except ProcessCallFailed as exception:\n        print(\"subprocess call failed for {} with code {}\".format(exception.cmd, exception.code))\n        print(exception.out, file=sys.stdout, end=\"\")\n        print(exception.err, file=sys.stderr, end=\"\")\n        raise SystemExit(exception.code)\n\n\nclass LogSession(object):\n    def __init__(self, session, start):\n        self.session = session\n        self.start = start\n\n    def __str__(self):\n        from virtualenv.util.six import ensure_text\n\n        spec = self.session.creator.interpreter.spec\n        elapsed = (datetime.now() - self.start).total_seconds() * 1000\n        lines = [\n            \"created virtual environment {} in {:.0f}ms\".format(spec, elapsed),\n            \"  creator {}\".format(ensure_text(str(self.session.creator))),\n        ]\n        if self.session.seeder.enabled:\n            lines += (\n                \"  seeder {}\".format(ensure_text(str(self.session.seeder))),\n                \"    added seed packages: {}\".format(\n                    \", \".join(\n                        sorted(\n                            \"==\".join(i.stem.split(\"-\"))\n                            for i in self.session.creator.purelib.iterdir()\n                            if i.suffix == \".dist-info\"\n                        ),\n                    ),\n                ),\n            )\n        if self.session.activators:\n            lines.append(\"  activators {}\".format(\",\".join(i.__class__.__name__ for i in self.session.activators)))\n        return os.linesep.join(lines)\n\n\ndef run_with_catch(args=None):\n    from virtualenv.config.cli.parser import VirtualEnvOptions\n\n    options = VirtualEnvOptions()\n    try:\n        run(args, options)\n    except (KeyboardInterrupt, SystemExit, Exception) as exception:\n        try:\n            if getattr(options, \"with_traceback\", False):\n                raise\n            else:\n                if not (isinstance(exception, SystemExit) and exception.code == 0):\n                    logging.error(\"%s: %s\", type(exception).__name__, exception)\n                code = exception.code if isinstance(exception, SystemExit) else 1\n                sys.exit(code)\n        finally:\n            logging.shutdown()  # force flush of log messages before the trace is printed\n\n\nif __name__ == \"__main__\":  # pragma: no cov\n    run_with_catch()  # pragma: no cov\n", "path": "src/virtualenv/__main__.py"}]}