From 4bf807fc911642c924c49e7bfd8372f64b5c6a5c Mon Sep 17 00:00:00 2001 From: Adriana Draghici Date: Thu, 29 Apr 2010 14:19:12 +0000 Subject: [PATCH] autorun: fixed out,err redirect in BitTorrentClientRun --- autorun/server/BitTorrentClientRun.py | 4 ++-- autorun/server/TriblerRun.py | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/autorun/server/BitTorrentClientRun.py b/autorun/server/BitTorrentClientRun.py index 5687ceb..8d22d38 100644 --- a/autorun/server/BitTorrentClientRun.py +++ b/autorun/server/BitTorrentClientRun.py @@ -78,8 +78,8 @@ class BitTorrentClientRun: print "log redirect to file ", (self.log_dir+"/"+self.log_file) p=subprocess.Popen(args, shell=False, #does not create sh process - stdout=log_redirect, - stderr=output_redirect) + stdout=output_redirect, + stderr=log_redirect) pid = p.pid if(DEBUG): print "BitTorrentClientRun: pid =", pid diff --git a/autorun/server/TriblerRun.py b/autorun/server/TriblerRun.py index 8e62760..dc06fce 100644 --- a/autorun/server/TriblerRun.py +++ b/autorun/server/TriblerRun.py @@ -6,10 +6,11 @@ """ import sys +import os import os.path from BitTorrentClientRun import BitTorrentClientRun -DEBUG = False +DEBUG = True class TriblerRun(BitTorrentClientRun): @@ -33,15 +34,15 @@ class TriblerRun(BitTorrentClientRun): f = open(filename, "r"); f_copy = open(tmp_filename, "w"); import_line = "import sys" - instr_line = "\nsys.path.append('"+base_path+"')\n" + instr_line = "sys.path.append('"+base_path+"')\n" exists = False position = -1 exists = False for line in f: - if line.find("import")>=0 and line.find("sys")>=0 and (not line.find("sys."))>=0: + if line.find("import")>=0 and line.find("sys")>=0 and (not (line.find("sys.")>=0)): #position = f.tell() + len(line) + 1 f_copy.write(line) - f_copy.write(instr_line) + f_copy.write("\n" + instr_line) continue if line == instr_line: exists = True -- 2.20.1