build/pymake/tests/pycmd.py

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 import os, sys, subprocess
     3 def writetofile(args):
     4   with open(args[0], 'w') as f:
     5     f.write(' '.join(args[1:]))
     7 def writeenvtofile(args):
     8   with open(args[0], 'w') as f:
     9     f.write(os.environ[args[1]])
    11 def writesubprocessenvtofile(args):
    12   with open(args[0], 'w') as f:
    13     p = subprocess.Popen([sys.executable, "-c",
    14                           "import os; print os.environ['%s']" % args[1]],
    15                           stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    16     stdout, stderr = p.communicate()
    17     assert p.returncode == 0
    18     f.write(stdout)
    20 def convertasplode(arg):
    21   try:
    22     return int(arg)
    23   except:
    24     return (None if arg == "None" else arg)
    26 def asplode(args):
    27   arg0 = convertasplode(args[0])
    28   sys.exit(arg0)
    30 def asplode_return(args):
    31   arg0 = convertasplode(args[0])
    32   return arg0
    34 def asplode_raise(args):
    35   raise Exception(args[0])
    37 def delayloadfn(args):
    38     import delayload

mercurial