execute shell to parse/execute command line

This commit is contained in:
Josh Holtrop 2011-02-04 10:53:25 -05:00
parent 231b980a2c
commit 0433a7c2db

View File

@ -1,6 +1,8 @@
#!/usr/bin/env python
import os
import sys
import re
import gtk
import gobject
@ -48,8 +50,13 @@ class Window:
def main(argv):
w = Window()
cmd = w.run()
print 'cmd:', cmd
cmd = w.run().strip()
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__":
main(sys.argv)