execute shell to parse/execute command line

This commit is contained in:
Josh Holtrop committed 2011-02-04 10:53:25 -05:00
1 parent 231b980a2c
commit 0433a7c2db
1 file changed
+9 -2
+9 -2
View File
@@ -1,6 +1,8 @@
#!/usr/bin/env python #!/usr/bin/env python
import os
import sys import sys
import re
import gtk import gtk
import gobject import gobject
@@ -48,8 +50,13 @@ class Window:
def main(argv): def main(argv):
w = Window() w = Window()
cmd = w.run() cmd = w.run().strip()
print 'cmd:', cmd shell = '/bin/sh'
if 'SHELL' in os.environ:
shell = os.environ['SHELL']
shname = re.sub('.*/', '', shell)
if cmd != '':
os.execl(shell, shname, '-c', cmd)
if __name__ == "__main__": if __name__ == "__main__":
main(sys.argv) main(sys.argv)