diff options
| author | Victor Kareh <[email protected]> | 2025-08-29 16:17:52 -0400 |
|---|---|---|
| committer | Victor Kareh <[email protected]> | 2025-09-02 17:52:49 +0000 |
| commit | 3bf3603bae502e52a0acd0a85a10466c3f1dbee1 (patch) | |
| tree | 28c30bf3163eaf95ff54d6ac28c7d5c235dd3bbb /examples/open-terminal.py | |
| parent | 581ce8c179f1912b8dc92a108990b180ae16d61a (diff) | |
| download | python-caja-3bf3603bae502e52a0acd0a85a10466c3f1dbee1.tar.bz2 python-caja-3bf3603bae502e52a0acd0a85a10466c3f1dbee1.tar.xz | |
Use subprocess calls instead of os.system
This removes the possibility of shell injection vulnerabilities.
Diffstat (limited to 'examples/open-terminal.py')
| -rw-r--r-- | examples/open-terminal.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/examples/open-terminal.py b/examples/open-terminal.py index 935d894..ff0909e 100644 --- a/examples/open-terminal.py +++ b/examples/open-terminal.py @@ -1,5 +1,6 @@ # This example is contributed by Martin Enlund import os +import subprocess from gi.repository import Caja, GObject, Gio @@ -15,7 +16,7 @@ class OpenTerminalExtension(Caja.MenuProvider, GObject.GObject): terminal = self.gsettings[TERMINAL_KEY] os.chdir(filename) - os.system('%s &' % terminal) + subprocess.Popen([terminal], cwd=filename) def menu_activate_cb(self, menu, file): self._open_terminal(file) |
