Skip to content

Commit

Permalink
tweets in the background - forgot to import sys
Browse files Browse the repository at this point in the history
  • Loading branch information
mfiers committed Jun 26, 2012
1 parent fefaea4 commit 3ca63e3
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions lib/python/moa/plugin/system/twit.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"""

import os
import sys
import time
import socket
from datetime import datetime, timedelta
Expand Down Expand Up @@ -78,16 +79,21 @@ def hook_postRun():
socket.gethostname().split('.')[0],
sysConf.job.wd,
niceRunTime(runtime))


#fork - don't wait for this!
pid = os.fork()
if pid != 0:
return

#start TTYter process
moa.ui.message('Sending tweet', store=False)
P = sp.Popen(['ttytter', '-script'], stdin=sp.PIPE,stdout=sp.PIPE, stderr=sp.PIPE, shell=True)
P = sp.Popen(['ttytter', '-script'], stdin=sp.PIPE, stdout=sp.PIPE, stderr=sp.PIPE, shell=True)
moa.ui.message('Message ' + message)
o,e = P.communicate(message)
with open('twitt.log', 'a') as F:
with open('.moa/twitt.log', 'a') as F:
F.write('\n\noo\n')
F.write(o)
F.write('\n\nee\n')
F.write(e)
F.write(e)
sys.exit(0)

0 comments on commit 3ca63e3

Please sign in to comment.