mirror of
https://github.com/j1g5awi/krunner-vscode.git
synced 2024-11-21 18:09:30 +00:00
Use subprocess to run VSCode (#5)
This removes the risk of any shell injection from `os.system`.
This commit is contained in:
parent
e2cbbcd1f4
commit
ea2aba100f
1 changed files with 5 additions and 5 deletions
|
@ -1,5 +1,6 @@
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import subprocess
|
||||||
import sqlite3
|
import sqlite3
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import NamedTuple
|
from typing import NamedTuple
|
||||||
|
@ -92,11 +93,10 @@ class Runner(dbus.service.Object):
|
||||||
|
|
||||||
@dbus.service.method(iface, in_signature="ss")
|
@dbus.service.method(iface, in_signature="ss")
|
||||||
def Run(self, data: str, action_id: str):
|
def Run(self, data: str, action_id: str):
|
||||||
if not action_id:
|
subprocess.run([
|
||||||
os.system("code " + data)
|
"code" if not action_id else "xdg-open",
|
||||||
else:
|
data
|
||||||
os.system("xdg-open " + data)
|
])
|
||||||
|
|
||||||
|
|
||||||
runner = Runner()
|
runner = Runner()
|
||||||
loop = GLib.MainLoop()
|
loop = GLib.MainLoop()
|
||||||
|
|
Loading…
Reference in a new issue