Example #1
0
def MODEremap(outdir, indir, dictfiles, read_only, _cmd, _relative_cwd,
              _resultfile):
    if not outdir:
        outdir = tempfile.mkdtemp(prefix='isolate')
    print 'Remapping into %s' % outdir
    if len(os.listdir(outdir)):
        print 'Can\'t remap in a non-empty directory'
        return 1
    recreate_tree(outdir, indir, dictfiles.keys(), tree_creator.HARDLINK)
    if read_only:
        tree_creator.make_writable(outdir, True)
    return 0
Example #2
0
def MODEremap(
    outdir, indir, dictfiles, read_only, _cmd, _relative_cwd, _resultfile):
  if not outdir:
    outdir = tempfile.mkdtemp(prefix='isolate')
  print 'Remapping into %s' % outdir
  if len(os.listdir(outdir)):
    print 'Can\'t remap in a non-empty directory'
    return 1
  recreate_tree(outdir, indir, dictfiles.keys(), tree_creator.HARDLINK)
  if read_only:
    tree_creator.make_writable(outdir, True)
  return 0
Example #3
0
def MODErun(_outdir, indir, dictfiles, read_only, cmd, relative_cwd,
            _resultfile):
    """Always uses a temporary directory."""
    try:
        outdir = tempfile.mkdtemp(prefix='isolate')
        recreate_tree(outdir, indir, dictfiles.keys(), tree_creator.HARDLINK)
        cwd = os.path.join(outdir, relative_cwd)
        if not os.path.isdir(cwd):
            os.makedirs(cwd)
        if read_only:
            tree_creator.make_writable(outdir, True)

        logging.info('Running %s, cwd=%s' % (cmd, cwd))
        return subprocess.call(cmd, cwd=cwd)
    finally:
        tree_creator.rmtree(outdir)
Example #4
0
def MODErun(
    _outdir, indir, dictfiles, read_only, cmd, relative_cwd, _resultfile):
  """Always uses a temporary directory."""
  try:
    outdir = tempfile.mkdtemp(prefix='isolate')
    recreate_tree(outdir, indir, dictfiles.keys(), tree_creator.HARDLINK)
    cwd = os.path.join(outdir, relative_cwd)
    if not os.path.isdir(cwd):
      os.makedirs(cwd)
    if read_only:
      tree_creator.make_writable(outdir, True)

    logging.info('Running %s, cwd=%s' % (cmd, cwd))
    return subprocess.call(cmd, cwd=cwd)
  finally:
    tree_creator.rmtree(outdir)