Replace braindead exec_command with subprocess.call, which can cope with shell metachars

This commit is contained in:
Thomas Hurst 2008-06-09 18:11:32 +01:00
parent 0803723ca9
commit be92d94057
1 changed files with 7 additions and 11 deletions

View File

@ -22,7 +22,7 @@ APP_NAME = 'terminator'
APP_VERSION = '0.9' APP_VERSION = '0.9'
# import standard python libs # import standard python libs
import os, platform, sys, string, time, math import os, platform, sys, string, time, math, subprocess
from optparse import OptionParser from optparse import OptionParser
try: try:
@ -89,14 +89,10 @@ except:
error.run() error.run()
sys.exit (1) sys.exit (1)
def exec_command(executable, *parameters):
command = [executable]
command.extend(parameters)
return os.system(command[0] + " \"%s\"" %command[1])
def openurl (url): def openurl (url):
if exec_command("xdg-open", url): try:
subprocess.call(["xdg-open", url])
except:
try: try:
url_show (url) url_show (url)
except: except:
@ -1026,9 +1022,9 @@ class Terminator:
keyname = gtk.gdk.keyval_name (event.keyval) keyname = gtk.gdk.keyval_name (event.keyval)
mask = gtk.gdk.CONTROL_MASK | gtk.gdk.SHIFT_MASK mask = gtk.gdk.CONTROL_MASK | gtk.gdk.SHIFT_MASK
if (keyname == 'F11'): #if (keyname == 'F11'):
self.fullscreen_toggle () # self.fullscreen_toggle ()
return (True) # return (True)
if (event.state & mask) == mask: if (event.state & mask) == mask:
if keyname == 'Q': if keyname == 'Q':