X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;ds=sidebyside;f=geekigeeki.py;h=4fb96cb8daff079dc820e7a9f7daf75f5bad8a7e;hb=e7014a267c2573629307cf426d591c8a39d34b24;hp=cc0373621ab6e4c11da560c253d9383cc40a9948;hpb=c0c495043d8f2f4edb5a37b108d7c400e0eb1498;p=geekigeeki.git diff --git a/geekigeeki.py b/geekigeeki.py index cc03736..4fb96cb 100755 --- a/geekigeeki.py +++ b/geekigeeki.py @@ -100,7 +100,7 @@ def send_guru(msg_text, msg_type): print ' Software Failure. Press left mouse button to continue.\n' print msg_text if msg_type == 'error': - print '\n Guru Meditation #DEADBEEF.ABADC0DE' + print '\n Guru Meditation #DEADBEEF.ABADC0DE' print '' try: sendfile(sys.stdout, open('gurumeditation.js', 'rb')) @@ -779,19 +779,13 @@ class Page: self._write_file(newdata) rc = 0 if post_edit_hook: - # FIXME: what's the std way to perform shell quoting in python? - cmd = ( post_edit_hook - + " '" + data_dir + '/' + self.page_name - + "' '" + remote_user() - + "' '" + remote_host() - + "' '" + changelog + "'" - ) - out = os.popen(cmd) - output = out.read() - rc = out.close() + import subprocess + cmd = [ post_edit_hook, data_dir + '/' + self.page_name, remote_user(), remote_host(), changelog] + child = subprocess.Popen(cmd, stdout=subprocess.PIPE, close_fds=True) + output = child.stdout.read() + rc = child.wait() if rc: - self.msg_text += "Post-editing hook returned %d.\n" % rc - self.msg_text += 'Command was: ' + cmd + '\n' + self.msg_text += "Post-editing hook returned %d. Command was:\n'%s'\n" % (rc, "' '".join(cmd)) if output: self.msg_text += 'Output follows:\n' + output else: