Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | import os, sys, subprocess |
michael@0 | 2 | |
michael@0 | 3 | def writetofile(args): |
michael@0 | 4 | with open(args[0], 'w') as f: |
michael@0 | 5 | f.write(' '.join(args[1:])) |
michael@0 | 6 | |
michael@0 | 7 | def writeenvtofile(args): |
michael@0 | 8 | with open(args[0], 'w') as f: |
michael@0 | 9 | f.write(os.environ[args[1]]) |
michael@0 | 10 | |
michael@0 | 11 | def writesubprocessenvtofile(args): |
michael@0 | 12 | with open(args[0], 'w') as f: |
michael@0 | 13 | p = subprocess.Popen([sys.executable, "-c", |
michael@0 | 14 | "import os; print os.environ['%s']" % args[1]], |
michael@0 | 15 | stdout=subprocess.PIPE, stderr=subprocess.PIPE) |
michael@0 | 16 | stdout, stderr = p.communicate() |
michael@0 | 17 | assert p.returncode == 0 |
michael@0 | 18 | f.write(stdout) |
michael@0 | 19 | |
michael@0 | 20 | def convertasplode(arg): |
michael@0 | 21 | try: |
michael@0 | 22 | return int(arg) |
michael@0 | 23 | except: |
michael@0 | 24 | return (None if arg == "None" else arg) |
michael@0 | 25 | |
michael@0 | 26 | def asplode(args): |
michael@0 | 27 | arg0 = convertasplode(args[0]) |
michael@0 | 28 | sys.exit(arg0) |
michael@0 | 29 | |
michael@0 | 30 | def asplode_return(args): |
michael@0 | 31 | arg0 = convertasplode(args[0]) |
michael@0 | 32 | return arg0 |
michael@0 | 33 | |
michael@0 | 34 | def asplode_raise(args): |
michael@0 | 35 | raise Exception(args[0]) |
michael@0 | 36 | |
michael@0 | 37 | def delayloadfn(args): |
michael@0 | 38 | import delayload |