We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
subprocess.CalledProcessError: Command '['/usr/local/bin/checksec', '--file', '/tmp/xxx']' returned non-zero exit status 2.
```
pwndbg> checksec 
Traceback (most recent call last):
  File "/root/pwndbg/pwndbg/commands/__init__.py", line 109, in __call__
    return self.function(*args, **kwargs)
  File "/root/pwndbg/pwndbg/commands/__init__.py", line 189, in _OnlyWithFile
    return function(*a, **kw)
  File "/root/pwndbg/pwndbg/commands/checksec.py", line 16, in checksec
    print(pwndbg.wrappers.checksec.get_raw_out())
  File "/root/pwndbg/pwndbg/commands/__init__.py", line 189, in _OnlyWithFile
    return function(*a, **kw)
  File "/root/pwndbg/pwndbg/wrappers/__init__.py", line 28, in _OnlyWithCommand
    return function(*a, **kw)
  File "/root/pwndbg/pwndbg/memoize.py", line 48, in __call__
    value = self.func(*args, **kwargs)
  File "/root/pwndbg/pwndbg/wrappers/checksec.py", line 20, in get_raw_out
    return pwndbg.wrappers.call_cmd(cmd)
  File "/root/pwndbg/pwndbg/wrappers/__init__.py", line 35, in call_cmd
    return subprocess.check_output(cmd, stderr=STDOUT).decode('utf-8')
  File "/usr/lib/python3.7/subprocess.py", line 395, in check_output
    **kwargs).stdout
  File "/usr/lib/python3.7/subprocess.py", line 487, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['/usr/local/bin/checksec', '--file', '/tmp/forgot']' returned non-zero exit status 2.
```

when checksec running in python3 pwntools environment, raise a failure. Here's the reason:
```
root@kali:/tmp# checksec --file forgot
usage: checksec [-h] elf [elf ...]
checksec: error: unrecognized arguments: --file
```


So modify pwndbg/pwndbg/wrappers/checksec.py: 19 with:
`cmd = [get_raw_out.cmd_path, local_path]`

Then it will be solved

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `pwndbg/wrappers/checksec.py`
Content:
```
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 from __future__ import absolute_import
4 from __future__ import division
5 from __future__ import print_function
6 from __future__ import unicode_literals
7 
8 import pwndbg.commands
9 import pwndbg.memoize
10 import pwndbg.wrappers
11 
12 cmd_name = "checksec"
13 
14 @pwndbg.wrappers.OnlyWithCommand(cmd_name)
15 @pwndbg.memoize.reset_on_objfile
16 def get_raw_out():
17 
18     local_path = pwndbg.file.get_file(pwndbg.proc.exe)
19     cmd = [get_raw_out.cmd_path, "--file", local_path]
20     return pwndbg.wrappers.call_cmd(cmd)
21 
22 @pwndbg.wrappers.OnlyWithCommand(cmd_name)
23 def relro_status():
24     relro = "No RELRO"
25     out = get_raw_out()
26 
27     if "Full RELRO" in out:
28         relro = "Full RELRO"
29     elif "Partial RELRO" in out:
30         relro = "Partial RELRO"
31 
32     return relro
33 
34 @pwndbg.wrappers.OnlyWithCommand(cmd_name)
35 def pie_status():
36     pie = "No PIE"
37     out = get_raw_out()
38 
39     if "PIE enabled" in out:
40         pie = "PIE enabled"
41 
42     return pie
43
```
--- 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/pwndbg/wrappers/checksec.py b/pwndbg/wrappers/checksec.py
--- a/pwndbg/wrappers/checksec.py
+++ b/pwndbg/wrappers/checksec.py
@@ -5,6 +5,10 @@
 from __future__ import print_function
 from __future__ import unicode_literals
 
+import subprocess
+from re import search
+from subprocess import STDOUT
+
 import pwndbg.commands
 import pwndbg.memoize
 import pwndbg.wrappers
@@ -14,10 +18,17 @@
 @pwndbg.wrappers.OnlyWithCommand(cmd_name)
 @pwndbg.memoize.reset_on_objfile
 def get_raw_out():
-
     local_path = pwndbg.file.get_file(pwndbg.proc.exe)
-    cmd = [get_raw_out.cmd_path, "--file", local_path]
-    return pwndbg.wrappers.call_cmd(cmd)
+    try:
+        version_output = subprocess.check_output([get_raw_out.cmd_path, "--version"], stderr=STDOUT).decode('utf-8')
+        match = search('checksec v([\\w.]+),', version_output)
+        if match:
+            version = tuple(map(int, (match.group(1).split("."))))
+            if version >= (2, 0):
+                return pwndbg.wrappers.call_cmd([get_raw_out.cmd_path, "--file=" + local_path])
+    except Exception:
+        pass
+    return pwndbg.wrappers.call_cmd([get_raw_out.cmd_path, "--file", local_path])
 
 @pwndbg.wrappers.OnlyWithCommand(cmd_name)
 def relro_status():

{"golden_diff": "diff --git a/pwndbg/wrappers/checksec.py b/pwndbg/wrappers/checksec.py\n--- a/pwndbg/wrappers/checksec.py\n+++ b/pwndbg/wrappers/checksec.py\n@@ -5,6 +5,10 @@\n from __future__ import print_function\n from __future__ import unicode_literals\n \n+import subprocess\n+from re import search\n+from subprocess import STDOUT\n+\n import pwndbg.commands\n import pwndbg.memoize\n import pwndbg.wrappers\n@@ -14,10 +18,17 @@\n @pwndbg.wrappers.OnlyWithCommand(cmd_name)\n @pwndbg.memoize.reset_on_objfile\n def get_raw_out():\n-\n     local_path = pwndbg.file.get_file(pwndbg.proc.exe)\n-    cmd = [get_raw_out.cmd_path, \"--file\", local_path]\n-    return pwndbg.wrappers.call_cmd(cmd)\n+    try:\n+        version_output = subprocess.check_output([get_raw_out.cmd_path, \"--version\"], stderr=STDOUT).decode('utf-8')\n+        match = search('checksec v([\\\\w.]+),', version_output)\n+        if match:\n+            version = tuple(map(int, (match.group(1).split(\".\"))))\n+            if version >= (2, 0):\n+                return pwndbg.wrappers.call_cmd([get_raw_out.cmd_path, \"--file=\" + local_path])\n+    except Exception:\n+        pass\n+    return pwndbg.wrappers.call_cmd([get_raw_out.cmd_path, \"--file\", local_path])\n \n @pwndbg.wrappers.OnlyWithCommand(cmd_name)\n def relro_status():\n", "issue": "subprocess.CalledProcessError: Command '['/usr/local/bin/checksec', '--file', '/tmp/xxx']' returned non-zero exit status 2.\n```\r\npwndbg> checksec \r\nTraceback (most recent call last):\r\n  File \"/root/pwndbg/pwndbg/commands/__init__.py\", line 109, in __call__\r\n    return self.function(*args, **kwargs)\r\n  File \"/root/pwndbg/pwndbg/commands/__init__.py\", line 189, in _OnlyWithFile\r\n    return function(*a, **kw)\r\n  File \"/root/pwndbg/pwndbg/commands/checksec.py\", line 16, in checksec\r\n    print(pwndbg.wrappers.checksec.get_raw_out())\r\n  File \"/root/pwndbg/pwndbg/commands/__init__.py\", line 189, in _OnlyWithFile\r\n    return function(*a, **kw)\r\n  File \"/root/pwndbg/pwndbg/wrappers/__init__.py\", line 28, in _OnlyWithCommand\r\n    return function(*a, **kw)\r\n  File \"/root/pwndbg/pwndbg/memoize.py\", line 48, in __call__\r\n    value = self.func(*args, **kwargs)\r\n  File \"/root/pwndbg/pwndbg/wrappers/checksec.py\", line 20, in get_raw_out\r\n    return pwndbg.wrappers.call_cmd(cmd)\r\n  File \"/root/pwndbg/pwndbg/wrappers/__init__.py\", line 35, in call_cmd\r\n    return subprocess.check_output(cmd, stderr=STDOUT).decode('utf-8')\r\n  File \"/usr/lib/python3.7/subprocess.py\", line 395, in check_output\r\n    **kwargs).stdout\r\n  File \"/usr/lib/python3.7/subprocess.py\", line 487, in run\r\n    output=stdout, stderr=stderr)\r\nsubprocess.CalledProcessError: Command '['/usr/local/bin/checksec', '--file', '/tmp/forgot']' returned non-zero exit status 2.\r\n```\r\n\r\nwhen checksec running in python3 pwntools environment, raise a failure. Here's the reason:\r\n```\r\nroot@kali:/tmp# checksec --file forgot\r\nusage: checksec [-h] elf [elf ...]\r\nchecksec: error: unrecognized arguments: --file\r\n```\r\n\r\n\r\nSo modify pwndbg/pwndbg/wrappers/checksec.py: 19 with:\r\n`cmd = [get_raw_out.cmd_path, local_path]`\r\n\r\nThen it will be solved\n", "before_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\n\nimport pwndbg.commands\nimport pwndbg.memoize\nimport pwndbg.wrappers\n\ncmd_name = \"checksec\"\n\n@pwndbg.wrappers.OnlyWithCommand(cmd_name)\n@pwndbg.memoize.reset_on_objfile\ndef get_raw_out():\n\n    local_path = pwndbg.file.get_file(pwndbg.proc.exe)\n    cmd = [get_raw_out.cmd_path, \"--file\", local_path]\n    return pwndbg.wrappers.call_cmd(cmd)\n\n@pwndbg.wrappers.OnlyWithCommand(cmd_name)\ndef relro_status():\n    relro = \"No RELRO\"\n    out = get_raw_out()\n\n    if \"Full RELRO\" in out:\n        relro = \"Full RELRO\"\n    elif \"Partial RELRO\" in out:\n        relro = \"Partial RELRO\"\n\n    return relro\n\n@pwndbg.wrappers.OnlyWithCommand(cmd_name)\ndef pie_status():\n    pie = \"No PIE\"\n    out = get_raw_out()\n\n    if \"PIE enabled\" in out:\n        pie = \"PIE enabled\"\n\n    return pie\n", "path": "pwndbg/wrappers/checksec.py"}], "after_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import\nfrom __future__ import division\nfrom __future__ import print_function\nfrom __future__ import unicode_literals\n\nimport subprocess\nfrom re import search\nfrom subprocess import STDOUT\n\nimport pwndbg.commands\nimport pwndbg.memoize\nimport pwndbg.wrappers\n\ncmd_name = \"checksec\"\n\n@pwndbg.wrappers.OnlyWithCommand(cmd_name)\n@pwndbg.memoize.reset_on_objfile\ndef get_raw_out():\n    local_path = pwndbg.file.get_file(pwndbg.proc.exe)\n    try:\n        version_output = subprocess.check_output([get_raw_out.cmd_path, \"--version\"], stderr=STDOUT).decode('utf-8')\n        match = search('checksec v([\\\\w.]+),', version_output)\n        if match:\n            version = tuple(map(int, (match.group(1).split(\".\"))))\n            if version >= (2, 0):\n                return pwndbg.wrappers.call_cmd([get_raw_out.cmd_path, \"--file=\" + local_path])\n    except Exception:\n        pass\n    return pwndbg.wrappers.call_cmd([get_raw_out.cmd_path, \"--file\", local_path])\n\n@pwndbg.wrappers.OnlyWithCommand(cmd_name)\ndef relro_status():\n    relro = \"No RELRO\"\n    out = get_raw_out()\n\n    if \"Full RELRO\" in out:\n        relro = \"Full RELRO\"\n    elif \"Partial RELRO\" in out:\n        relro = \"Partial RELRO\"\n\n    return relro\n\n@pwndbg.wrappers.OnlyWithCommand(cmd_name)\ndef pie_status():\n    pie = \"No PIE\"\n    out = get_raw_out()\n\n    if \"PIE enabled\" in out:\n        pie = \"PIE enabled\"\n\n    return pie\n", "path": "pwndbg/wrappers/checksec.py"}]}