We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
UnicodeDecodeError
Why i get error if type help command?
Python 3.8.10
Scons 4.2.0
![Безымянный](https://user-images.githubusercontent.com/64489444/131680807-3b5b91f2-32f5-428b-ae24-39e820ce0c88.png)

UnicodeDecodeError
Why i get error if type help command?
Python 3.8.10
Scons 4.2.0
![Безымянный](https://user-images.githubusercontent.com/64489444/131680807-3b5b91f2-32f5-428b-ae24-39e820ce0c88.png)


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `SCons/Tool/gcc.py`
Content:
```
1 # MIT License
2 #
3 # Copyright The SCons Foundation
4 #
5 # Permission is hereby granted, free of charge, to any person obtaining
6 # a copy of this software and associated documentation files (the
7 # "Software"), to deal in the Software without restriction, including
8 # without limitation the rights to use, copy, modify, merge, publish,
9 # distribute, sublicense, and/or sell copies of the Software, and to
10 # permit persons to whom the Software is furnished to do so, subject to
11 # the following conditions:
12 #
13 # The above copyright notice and this permission notice shall be included
14 # in all copies or substantial portions of the Software.
15 #
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
17 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
18 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 
24 """SCons.Tool.gcc
25 
26 Tool-specific initialization for gcc.
27 
28 There normally shouldn't be any need to import this module directly.
29 It will usually be imported through the generic SCons.Tool.Tool()
30 selection method.
31 
32 """
33 
34 from . import cc
35 import re
36 import subprocess
37 
38 import SCons.Util
39 
40 compilers = ['gcc', 'cc']
41 
42 
43 def generate(env):
44     """Add Builders and construction variables for gcc to an Environment."""
45 
46     if 'CC' not in env:
47         env['CC'] = env.Detect(compilers) or compilers[0]
48 
49     cc.generate(env)
50 
51     if env['PLATFORM'] in ['cygwin', 'win32']:
52         env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS')
53     else:
54         env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS -fPIC')
55     # determine compiler version
56     version = detect_version(env, env['CC'])
57     if version:
58         env['CCVERSION'] = version
59 
60 
61 def exists(env):
62     # is executable, and is a GNU compiler (or accepts '--version' at least)
63     return detect_version(env, env.Detect(env.get('CC', compilers)))
64 
65 
66 def detect_version(env, cc):
67     """Return the version of the GNU compiler, or None if it is not a GNU compiler."""
68     version = None
69     cc = env.subst(cc)
70     if not cc:
71         return version
72 
73     # -dumpversion was added in GCC 3.0.  As long as we're supporting
74     # GCC versions older than that, we should use --version and a
75     # regular expression.
76     # pipe = SCons.Action._subproc(env, SCons.Util.CLVar(cc) + ['-dumpversion'],
77     pipe=SCons.Action._subproc(env, SCons.Util.CLVar(cc) + ['--version'],
78                                  stdin='devnull',
79                                  stderr='devnull',
80                                  stdout=subprocess.PIPE)
81     if pipe.wait() != 0:
82         return version
83 
84     with pipe.stdout:
85         # -dumpversion variant:
86         # line = pipe.stdout.read().strip()
87         # --version variant:
88         line = SCons.Util.to_str(pipe.stdout.readline())
89         # Non-GNU compiler's output (like AIX xlc's) may exceed the stdout buffer:
90         # So continue with reading to let the child process actually terminate.
91         while SCons.Util.to_str(pipe.stdout.readline()):
92             pass
93 
94 
95     # -dumpversion variant:
96     # if line:
97     #     version = line
98     # --version variant:
99     match = re.search(r'[0-9]+(\.[0-9]+)+', line)
100     if match:
101         version = match.group(0)
102 
103     return version
104 
105 # Local Variables:
106 # tab-width:4
107 # indent-tabs-mode:nil
108 # End:
109 # vim: set expandtab tabstop=4 shiftwidth=4:
110
```
--- 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/SCons/Tool/gcc.py b/SCons/Tool/gcc.py
--- a/SCons/Tool/gcc.py
+++ b/SCons/Tool/gcc.py
@@ -88,7 +88,8 @@
         line = SCons.Util.to_str(pipe.stdout.readline())
         # Non-GNU compiler's output (like AIX xlc's) may exceed the stdout buffer:
         # So continue with reading to let the child process actually terminate.
-        while SCons.Util.to_str(pipe.stdout.readline()):
+        # We don't need to know the rest of the data, so don't bother decoding.
+        while pipe.stdout.readline():
             pass

{"golden_diff": "diff --git a/SCons/Tool/gcc.py b/SCons/Tool/gcc.py\n--- a/SCons/Tool/gcc.py\n+++ b/SCons/Tool/gcc.py\n@@ -88,7 +88,8 @@\n         line = SCons.Util.to_str(pipe.stdout.readline())\n         # Non-GNU compiler's output (like AIX xlc's) may exceed the stdout buffer:\n         # So continue with reading to let the child process actually terminate.\n-        while SCons.Util.to_str(pipe.stdout.readline()):\n+        # We don't need to know the rest of the data, so don't bother decoding.\n+        while pipe.stdout.readline():\n             pass\n", "issue": "UnicodeDecodeError\nWhy i get error if type help command?\r\nPython 3.8.10\r\nScons 4.2.0\r\n![\u0411\u0435\u0437\u044b\u043c\u044f\u043d\u043d\u044b\u0439](https://user-images.githubusercontent.com/64489444/131680807-3b5b91f2-32f5-428b-ae24-39e820ce0c88.png)\r\n\nUnicodeDecodeError\nWhy i get error if type help command?\r\nPython 3.8.10\r\nScons 4.2.0\r\n![\u0411\u0435\u0437\u044b\u043c\u044f\u043d\u043d\u044b\u0439](https://user-images.githubusercontent.com/64489444/131680807-3b5b91f2-32f5-428b-ae24-39e820ce0c88.png)\r\n\n", "before_files": [{"content": "# MIT License\n#\n# Copyright The SCons Foundation\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a copy of this software and associated documentation files (the\n# \"Software\"), to deal in the Software without restriction, including\n# without limitation the rights to use, copy, modify, merge, publish,\n# distribute, sublicense, and/or sell copies of the Software, and to\n# permit persons to whom the Software is furnished to do so, subject to\n# the following conditions:\n#\n# The above copyright notice and this permission notice shall be included\n# in all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY\n# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE\n# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\"\"\"SCons.Tool.gcc\n\nTool-specific initialization for gcc.\n\nThere normally shouldn't be any need to import this module directly.\nIt will usually be imported through the generic SCons.Tool.Tool()\nselection method.\n\n\"\"\"\n\nfrom . import cc\nimport re\nimport subprocess\n\nimport SCons.Util\n\ncompilers = ['gcc', 'cc']\n\n\ndef generate(env):\n    \"\"\"Add Builders and construction variables for gcc to an Environment.\"\"\"\n\n    if 'CC' not in env:\n        env['CC'] = env.Detect(compilers) or compilers[0]\n\n    cc.generate(env)\n\n    if env['PLATFORM'] in ['cygwin', 'win32']:\n        env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS')\n    else:\n        env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS -fPIC')\n    # determine compiler version\n    version = detect_version(env, env['CC'])\n    if version:\n        env['CCVERSION'] = version\n\n\ndef exists(env):\n    # is executable, and is a GNU compiler (or accepts '--version' at least)\n    return detect_version(env, env.Detect(env.get('CC', compilers)))\n\n\ndef detect_version(env, cc):\n    \"\"\"Return the version of the GNU compiler, or None if it is not a GNU compiler.\"\"\"\n    version = None\n    cc = env.subst(cc)\n    if not cc:\n        return version\n\n    # -dumpversion was added in GCC 3.0.  As long as we're supporting\n    # GCC versions older than that, we should use --version and a\n    # regular expression.\n    # pipe = SCons.Action._subproc(env, SCons.Util.CLVar(cc) + ['-dumpversion'],\n    pipe=SCons.Action._subproc(env, SCons.Util.CLVar(cc) + ['--version'],\n                                 stdin='devnull',\n                                 stderr='devnull',\n                                 stdout=subprocess.PIPE)\n    if pipe.wait() != 0:\n        return version\n\n    with pipe.stdout:\n        # -dumpversion variant:\n        # line = pipe.stdout.read().strip()\n        # --version variant:\n        line = SCons.Util.to_str(pipe.stdout.readline())\n        # Non-GNU compiler's output (like AIX xlc's) may exceed the stdout buffer:\n        # So continue with reading to let the child process actually terminate.\n        while SCons.Util.to_str(pipe.stdout.readline()):\n            pass\n\n\n    # -dumpversion variant:\n    # if line:\n    #     version = line\n    # --version variant:\n    match = re.search(r'[0-9]+(\\.[0-9]+)+', line)\n    if match:\n        version = match.group(0)\n\n    return version\n\n# Local Variables:\n# tab-width:4\n# indent-tabs-mode:nil\n# End:\n# vim: set expandtab tabstop=4 shiftwidth=4:\n", "path": "SCons/Tool/gcc.py"}], "after_files": [{"content": "# MIT License\n#\n# Copyright The SCons Foundation\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a copy of this software and associated documentation files (the\n# \"Software\"), to deal in the Software without restriction, including\n# without limitation the rights to use, copy, modify, merge, publish,\n# distribute, sublicense, and/or sell copies of the Software, and to\n# permit persons to whom the Software is furnished to do so, subject to\n# the following conditions:\n#\n# The above copyright notice and this permission notice shall be included\n# in all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY\n# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE\n# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\"\"\"SCons.Tool.gcc\n\nTool-specific initialization for gcc.\n\nThere normally shouldn't be any need to import this module directly.\nIt will usually be imported through the generic SCons.Tool.Tool()\nselection method.\n\n\"\"\"\n\nfrom . import cc\nimport re\nimport subprocess\n\nimport SCons.Util\n\ncompilers = ['gcc', 'cc']\n\n\ndef generate(env):\n    \"\"\"Add Builders and construction variables for gcc to an Environment.\"\"\"\n\n    if 'CC' not in env:\n        env['CC'] = env.Detect(compilers) or compilers[0]\n\n    cc.generate(env)\n\n    if env['PLATFORM'] in ['cygwin', 'win32']:\n        env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS')\n    else:\n        env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS -fPIC')\n    # determine compiler version\n    version = detect_version(env, env['CC'])\n    if version:\n        env['CCVERSION'] = version\n\n\ndef exists(env):\n    # is executable, and is a GNU compiler (or accepts '--version' at least)\n    return detect_version(env, env.Detect(env.get('CC', compilers)))\n\n\ndef detect_version(env, cc):\n    \"\"\"Return the version of the GNU compiler, or None if it is not a GNU compiler.\"\"\"\n    version = None\n    cc = env.subst(cc)\n    if not cc:\n        return version\n\n    # -dumpversion was added in GCC 3.0.  As long as we're supporting\n    # GCC versions older than that, we should use --version and a\n    # regular expression.\n    # pipe = SCons.Action._subproc(env, SCons.Util.CLVar(cc) + ['-dumpversion'],\n    pipe=SCons.Action._subproc(env, SCons.Util.CLVar(cc) + ['--version'],\n                                 stdin='devnull',\n                                 stderr='devnull',\n                                 stdout=subprocess.PIPE)\n    if pipe.wait() != 0:\n        return version\n\n    with pipe.stdout:\n        # -dumpversion variant:\n        # line = pipe.stdout.read().strip()\n        # --version variant:\n        line = SCons.Util.to_str(pipe.stdout.readline())\n        # Non-GNU compiler's output (like AIX xlc's) may exceed the stdout buffer:\n        # So continue with reading to let the child process actually terminate.\n        # We don't need to know the rest of the data, so don't bother decoding.\n        while pipe.stdout.readline():\n            pass\n\n\n    # -dumpversion variant:\n    # if line:\n    #     version = line\n    # --version variant:\n    match = re.search(r'[0-9]+(\\.[0-9]+)+', line)\n    if match:\n        version = match.group(0)\n\n    return version\n\n# Local Variables:\n# tab-width:4\n# indent-tabs-mode:nil\n# End:\n# vim: set expandtab tabstop=4 shiftwidth=4:\n", "path": "SCons/Tool/gcc.py"}]}