Run funnel TES server with rabix bunny for CWL.
189882
def _run_funnel(args):
    
    host = "localhost"
    port = "8088"
    main_file, json_file, project_name = _get_main_and_json(args.directory)
    work_dir = utils.safe_makedir(os.path.join(os.getcwd(), "funnel_work"))
    log_file = os.path.join(work_dir, "%s-funnel.log" % project_name)
    # Create bunny configuration directory with TES backend
    orig_config_dir = os.path.join(os.path.dirname(os.path.realpath(utils.which("rabix"))), "config")
    work_config_dir = utils.safe_makedir(os.path.join(work_dir, "rabix_config"))
    for fname in os.listdir(orig_config_dir):
        if fname == "core.properties":
            with open(os.path.join(orig_config_dir, fname)) as in_handle:
                with open(os.path.join(work_config_dir, fname), "w") as out_handle:
                    for line in in_handle:
                        if line.startswith("backend.embedded.types"):
                            line = "backend.embedded.types=TES\n"
                        out_handle.write(line)
        else:
            shutil.copy(os.path.join(orig_config_dir, fname), os.path.join(work_config_dir, fname))
    flags = ["-c", work_config_dir,
             "-tes-url=http://%s:%s" % (host, port), "-tes-storage=%s" % work_dir]
    if args.no_container:
        _remove_bcbiovm_path()
        flags += ["--no-container"]
    cmd = ["rabix"] + flags + [main_file, json_file]
    funnelp = subprocess.Popen(["funnel", "server", "run",
                                "--Server.HostName", host, "--Server.HTTPPort", port,
                                "--LocalStorage.AllowedDirs", work_dir,
                                "--Worker.WorkDir", os.path.join(work_dir, "funnel-work")])
    try:
        with utils.chdir(work_dir):
            _run_tool(cmd, not args.no_container, work_dir, log_file)
    finally:
        funnelp.kill()
344233
function runJekyll (next) {

      // Build the command string
      if (options.bundleExec) {
        command = 'bundle exec ' + command;
      }

      if (options.serve) {
        command += majorVersion > 0 ? ' serve' : ' server';
      }
      else {
        command += ' build';
      }

      // Insert temporary config path into the config option
      if (typeof rawConfigFile !== 'undefined') {
        options.config = options.config ? options.config + ',' + rawConfigFile : rawConfigFile;
      }

      // Add flags to command if running serve or build
      Object.keys(optionList).forEach(function(option) {
        if (options[option]) {
          command += ' ' + optionList[option];
          if (typeof options[option] !== 'boolean') {
            command += ' ' + options[option];
          }
          if (!options[option]) {
            grunt.warn('`' + option + '` has been deprecated. You may want to try this as a `raw` option in your Gruntfile or in `_config.yml`.');
          }
        }
      });

      // Execute command
      grunt.log.write('`' + command + '` was initiated.\n');

      if (options.serve) {
        grunt.log.write('Started web server on http://localhost:' + (options.port || 4000) + '. Press Ctrl-C to stop it.\n');
      }

      exec(command, function(err, stdout) {
        grunt.log.write('\n\nJekyll output:\n' + stdout);

        if (err) {
          grunt.fail.warn(err);
          done(false);
        }
        else {
          next();
        }
      });
    }
798770
function run(options) {
    // If the server is already available use it.
    var site = options.server ? options.server() : express();
    var protocol = options.ssl ? "https" : "http";

    // Allow compression to be disabled.
    if (options.gzip !== false) {
      site.use(compression());
    }

    // Go through each compiler and provide an identical serving experience.
    _.each(options.middleware, function(callback, extension) {
      // Investigate if there is a better way of writing this.
      site.get(new RegExp(extension), function(req, res, next) {
        var url = req.url;

        // If there are query parameters, remove them.
        url = url.split("?")[0];

        // Determine the correct asset path.
        var path = options.map[url.slice(1)] || "." + url;

        // Read in the file contents.
        fs.readFile(path, function(err, buffer) {
          // File wasn't found.
          if (err) {
            return next();
          }

          callback(buffer, req, res, next);
        });
      });
    });

    // Map static folders to take precedence over redirection.
    Object.keys(options.map).sort().reverse().forEach(function(name) {
      var normalizePath = path.join(options.prefix, options.map[name]);
      var dirMatch = grunt.file.isDir(normalizePath) ? "/*" : "";
      site.get(options.root + name + dirMatch, function(req, res, next) {
        // Find filename.
        var filename = req.url.slice((options.root + name).length);
        // If there are query parameters, remove them.
        filename = filename.split("?")[0];

        res.sendFile(path.join(normalizePath, filename), { root: './' });
      });
    });

    // Very similar to map, except that the mapped path is another server.
    Object.keys(options.proxy).sort().reverse().forEach(function(name) {
      var target = options.proxy[name];
      var protocol = target.https ? "https" : "http";

      var proxyOptions = {
        // This can be a string or an object.
        target: target,

        // Do not change the origin, this can affect how servers respond.
        changeOrigin: false,

        // Remove the forwarded headers, make it feel seamless.
        enable : {
          xforward: false
        }
      };

      // Ensure the https proxy settings are configured here as well.
      if (_.isBoolean(target.https) && target.https) {
        proxyOptions.https = {
          key: fs.readFileSync(__dirname + "/ssl/server.key", "utf8"),
          cert: fs.readFileSync(__dirname + "/ssl/server.crt", "utf8")
        };
      }

      // Initialize the actual proxy object.
      var proxy = new httpProxy.createProxy(proxyOptions);

      // Same thing for these, if you have https boolean set to true, default
      // to internal keys/certs.
      if (_.isBoolean(target.https) && target.https) {
        // Load the SSL certificates, in case they are needed.
        target.https = {
          key: fs.readFileSync(__dirname + "/ssl/server.key", "utf8"),
          cert: fs.readFileSync(__dirname + "/ssl/server.crt", "utf8")
        };
      }

      // Listen on all HTTP verbs for seamless proxying.
      site.all(options.root + name, function(req, res, next) {
        var referer = protocol + "://" + options.host;
        var origin = protocol + "://" + proxyOptions.target.host;

        if (options.port !== "80") {
          referer += ":" + options.port;
        }

        // Transparently set the referer, origin, and host headers.
        _.extend(req.headers, {
          referer: origin,
          origin: origin,
          host: proxyOptions.target.host,
          accept: req.headers.accept || "*/*"
        }, target.headers);

        if (String(req.headers.accept) === "undefined") {
          req.headers.accept = "*/*";
        }

        // Make the proxy request.
        proxy.proxyRequest(req, res);
      });
    });

    // Compression middleware.
    site.all("*", function(content, req, res, next) {
      if (content) {
        return res.send(content);
      }

      next();
    });

    // Attempt to laod from the prefixed directory first.
    //site.use(express.static(path.join(CWD, options.prefix)));
    site.all("*", function(req, res, next) {
      // If there are query parameters, remove them.
      var filename = path.join(options.prefix, req.url.split("?")[0]);

      // Detect if the file requested exists in the current prefixed path.
      fs.exists(filename, function(exists) {
        // If the file doesn't exist or if it's a folder, let another handler
        // take care of serving.
        if (!exists || filename.slice(-1) === path.sep) {
          next();
        } else {
          res.sendFile(filename, {root: './'});
        }
      });
    });

    // Ensure all routes go home, client side app..
    if (options.pushState) {
      site.all("*", function(req, res) {
        fs.createReadStream(path.join(options.prefix, options.index)).pipe(res);
      });
    }

    // Echo out a message alerting the user that the server is running.
    console.log("Listening on", protocol + "://" + options.host + ":" +
      options.port);

    // Start listening.
    if (!options.ssl) {
      return site.listen(options.port, options.host);
    }

    // Create the SSL server instead...
    https.createServer(options.ssl, site).listen(options.port, options.host);
  }
1314425
def run(self):
        ''''''

        if subprocess.call(['npm', '--version']) != 0:
            raise RuntimeError('npm is required to build the HTML renderer.')

        self.check_call(['npm', 'install'], cwd=HTML_RENDERER_DIR)
        self.check_call(['npm', 'run', 'build'], cwd=HTML_RENDERER_DIR)

        self.copy_file(HTML_RENDERER_DIR+'/dist/js/app.js', 'pyinstrument/renderers/html_resources/app.js')

        setuptools.command.build_py.build_py.run(self)
726257
function run(opts, cb){
  opts.extensions = opts.extensions ? opts.extensions + ',.jsx' : '.jsx';

  // glob-all fixes windows glob issues and provides array support
  // i.e. jsxhint ['jsx/**/*','!scripts/**/*','scripts/outlier.jsx']
  runGlob(opts.args, {nodir: true}, function(err, globbed) {
    if (err) return cb(err);

    // Reassign the globbed files back to opts.args, so it looks like we just
    // fed jshint a big list of files.
    opts.args = globbed;
    var files = jshintcli.gather(opts);

    if (opts.useStdin) {
      jsxhint.transformStream(process.stdin, jsxhintOptions, opts, cb);
    } else {
      jsxhint.transformFiles(files, jsxhintOptions, opts, cb);
    }
  });
}
89262
def runctx(self, cmd, globals, locals):
        """"""
        with self():
            exec(cmd, globals, locals)
        return self
936034
def run():
    """"""

    # NOTE(kiennt): Until now, this example isn't finished yet,
    #               because we don't have any completed driver

    # Get a network client with openstack driver.

    network_client = client.Client(version=_VERSION,
                        resource=_RESOURCES[0], provider=_PROVIDER)
    # net = network_client.create('daikk', '10.0.0.0/24')
    # list_subnet = network_client.list()
    # network_client.show(list_subnet[0].get("id"))
    network_client.delete("4b983028-0f8c-4b63-b10c-6e8420bb7903")
328287
def run():
    """"""

    command = sys.argv[1].strip().lower()
    print('[COMMAND]:', command)

    if command == 'test':
        return run_test()
    elif command == 'build':
        return run_build()
    elif command == 'up':
        return run_container()
    elif command == 'serve':
        import cauldron
        cauldron.run_server(port=5010, public=True)
924863
def run():
    
    server_address = (args.listen_addr, args.listen_port)
    httpd = YHSM_VALServer(server_address, YHSM_VALRequestHandler)
    my_log_message(args, syslog.LOG_INFO, "Serving requests to 'http://%s:%s%s' (YubiHSM: '%s')" \
                       % (args.listen_addr, args.listen_port, args.serve_url, args.device))
    httpd.serve_forever()
57459
function setupBundler(cwd, entryPoints, flags, noWatchify, ready) {
  noWatchify ?
    onlocalwatchify() :
    resolve('watchify', {basedir: cwd}, onlocalwatchify)

  function onlocalwatchify(err, localDir) {
    if(err || !localDir) {
      return resolve('browserify', {basedir: cwd}, onlocalbrowserify)
    }

    setupWatchify(path.dirname(localDir), entryPoints, flags, ready)
  }

  function onlocalbrowserify(err, localDir) {
    if(err || !localDir) {
      return findGlobals(onglobals)
    }

    setupBrowserify(path.dirname(localDir), entryPoints, flags, ready)
  }

  function onglobals(err, dirs) {
    if(err) {
      return ready(err)
    }

    dirs = dirs.sort()

    for(var i = 0, len = dirs.length; i < len; ++i) {
      if(!noWatchify && path.basename(dirs[i]) === 'watchify') {
        return setupWatchify(dirs[i], entryPoints, flags, ready)
      }

      if(path.basename(dirs[i]) === 'browserify') {
        return setupBrowserify(dirs[i], entryPoints, flags, ready)
      }
    }

    return ready(new Error('Could not find a suitable bundler!'))
  }
}
578309
function runJavaServer(javaHome, options) {
	return new Promise(function(resolve, reject) {
		const child = path.join(javaHome, '/jre/bin/java'),
			params = [];
		if (DEBUG) {
			params.push('-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1044');
		}
		params.push("-Dlog.level=ALL");
		params.push('-Declipse.application=org.eclipse.jdt.ls.core.id1');
		params.push('-Dosgi.bundles.defaultStartLevel=4');
		params.push('-Declipse.product=org.eclipse.jdt.ls.core.product');
		if (DEBUG) {
			params.push('-Dlog.protocol=true');
		}
		var pluginsFolder = path.resolve(__dirname, './plugins');
		return fs.readdirAsync(pluginsFolder).then(function(files) {
			if (Array.isArray(files) && files.length !== 0) {
				for (var i = 0, length = files.length; i < length; i++) {
					var file = files[i];
					var indexOf = file.indexOf('org.eclipse.equinox.launcher_');
					if (indexOf !== -1) {
						params.push('-jar');
						params.push(path.resolve(__dirname, './plugins/' + file));
			
						//select configuration directory according to OS
						var configDir = 'config_win';
						if (process.platform === 'darwin') {
							configDir = 'config_mac';
						} else if (process.platform === 'linux') {
							configDir = 'config_linux';
						}
						params.push('-configuration');
						params.push(path.resolve(__dirname, configDir));
						params.push('-data');
						params.push(options.workspaceDir);
					}
				}
				return fork(child, params, options).then((childProcess) => {
					resolve(childProcess);
				}, (err) => {
					reject(err);
				});
			}
		});
	});
}
452782
function runProtractorAoT(appDir, outputFile) {
  fs.appendFileSync(outputFile, '++ AoT version ++\n');
  const aotBuildSpawnInfo = spawnExt('yarn', ['build:aot'], {cwd: appDir});
  let promise = aotBuildSpawnInfo.promise;

  const copyFileCmd = 'copy-dist-files.js';
  if (fs.existsSync(appDir + '/' + copyFileCmd)) {
    promise = promise.then(() => spawnExt('node', [copyFileCmd], {cwd: appDir}).promise);
  }
  const aotRunSpawnInfo = spawnExt('yarn', ['serve:aot'], {cwd: appDir}, true);
  return runProtractorSystemJS(promise, appDir, aotRunSpawnInfo, outputFile);
}
1112577
function rdRoute(client, serverType, msg, cb) {
    const servers = client._station.serversMap[serverType];
    if (!servers || !servers.length) {
        utils.invokeCallback(cb, new Error(`rpc servers not exist with serverType: ${serverType}`));
        return;
    }
    const index = Math.floor(Math.random() * servers.length);
    utils.invokeCallback(cb, null, servers[index]);
}
65163
function start(root, distPath) {
  return new Promise((resolve, reject) => {

    const dist = path.resolve(process.cwd(), distPath || 'dist');

    logger.info('Creating web server');
    app.use(cors());

    logger.info(`Exposing static directory: ${dist}`);
    app.use(express.static(dist));
    if (root) {
      logger.info(`Mapping server requests from ${root} to ${dist}`);
      app.use(root, express.static(dist));
    }

    const options = {
      cert: fs.readFileSync(path.resolve(__dirname, '../../ssl/server.crt')),
      key: fs.readFileSync(path.resolve(__dirname, '../../ssl/server.key'))
    };

    server = https.createServer(options, app);
    server.on('error', reject);

    logger.info('Requesting open port...');
    portfinder
      .getPortPromise()
      .then(port => {
        logger.info(`Open port found: ${port}`);
        logger.info('Starting web server...');
        server.listen(port, 'localhost', () => {
          logger.info('Web server running.');
          resolve(port);
        });
      })
      .catch(reject);
  });
}
295544
function createEngine(options = {}) {
    const isManaged = argv.GamePort || argv.StartPort || argv.LadderServer;

    const opts = {
        port: 5000,
        host : '127.0.0.1',
        launch: true,
        ...options,
    };

    // the ladder manager is launching this agent and it should override anything else
    if (isManaged) {
        opts.port = argv.GamePort;
        opts.host = argv.LadderServer;
    }
    
    opts.onGameEnd = opts.onGameEnd || NOOP;

    const world = World();
    const { actions: { _client } } = world.resources.get();

    /** @type {Engine} */
    const engine = {
        _totalLoopDelay: 0,
        _gameLeft: false,
        launcher,
        use(sys) {
            if (Array.isArray(sys)) {
                sys.forEach(s => this.systems.push(s));
            } else {
                this.systems.push(sys);
            }
        },
        systems: [],
        async connect() {
            if (opts.launch && !isManaged) {
                await launcher(opts);
            }

            const pingRes = await _client.connect(opts);

            /** 
             * @TODO: @node-sc2/proto should be throwing a custom error type here so we
             * can safely expect what the error shape is -
             */

            _client._ws.on('error', (e) => {
                // @ts-ignore
                debugEngine('Received error from transport layer:', e);
            });

            _client._ws.on('leftGame', () => {
                this._gameLeft = true;
            });

            return pingRes;
        },
        async runGame(map = '', players = []) {
            const player = players.find(p => !!p.agent);
            player.agent.settings.race = player.race;

            await this.createGame(map, players);
            return this.joinGame(player.agent);
        },
        async createGame(map = '', playerSetup = [], realtime = false) {
            if (isManaged) {
                debugEngine(`Engine tried to create a game, but is being managed by a ladder manager - skipping...`);
                return;
            }

            if (_client.status !== 1 && _client.status !== 5) {
                console.warn(`cannot create a game unless in "launched" or "ended" status, current status is ${StatusId[_client.status]}`);
                return;
            }

            let mapPath, battlenetMapName;

            if (map.includes('SC2Map')) {
                mapPath = map;
            } else {
                try {
                    mapPath = await findMap(map);
                } catch (e) {
                    battlenetMapName = map;
                }
            }

            /** @type {SC2APIProtocol.RequestCreateGame} */
            const game = {
                realtime,
                playerSetup,
            };

            if (mapPath) {
                game.localMap = { mapPath };
            } else {
                game.battlenetMapName = battlenetMapName;
            }

            // @FIXME: battlenet map cache sort of is broken

            debugEngine('CREATE GAME REQUEST: ', game);

            return _client.createGame(game);
        },
        async joinGame(agent, options = {}) {
            world.agent = agent;
            
            if (!agent.interface.raw) {
                throw new Error('`raw` is currently the only interface supported by this engine.');
            }

            switch (_client.status) {
                case 1:
                case 2: {
                    /** @type {SC2APIProtocol.RequestJoinGame} */
                    let participant = {
                        race: agent.settings && agent.settings.race || Race.RANDOM,
                        options: agent.interface,
                        ...options
                    };

                    if (isManaged) {
                        let sPort = /** @type {number} */ argv.StartPort + 1;

                        participant = {
                            ...participant,
                            sharedPort: sPort++,
                            serverPorts: {
                                gamePort: sPort++, 
                                basePort: sPort++,
                            },
                            clientPorts: [{
                                gamePort: sPort++,
                                basePort: sPort++,
                            }, {
                                gamePort: sPort++,
                                basePort: sPort++,
                            }]
                        };
                    }

                    // join the game and subsequently set the playerId for the bot
                    const joinGame = await _client.joinGame(participant);
                    debugEngine('JOIN GAME RES: ', joinGame);

                    agent.playerId = joinGame.playerId;

                    return this.firstRun();
                }

                case 3: {
                    console.warn(`cannot join lobby for a game already in progress, attemping to resync to existing game...`);

                    /* @FIXME how do we actually negotiate our player id here for resyncing? assuming 1 for debugging... */
                    agent.playerId = 1;

                    return this.firstRun();
                }

                default: {
                    throw new Error(`cannot join a game this engine didn't create unless in "launched" status, current status is ${StatusId[_client.status]}`);
                }

            }
        },
        async firstRun() {
            const { data, resources, agent } = world;

            /** @type {SC2APIProtocol.ResponseData} */
            const gameData = await _client.data({
                abilityId: true,
                unitTypeId: true,
                upgradeId: true,
                buffId: true,
                effectId: true,
            });

            ['abilities', 'units', 'upgrades', 'buffs', 'effects'].forEach((dataType) => {
                if (gameData[dataType]) data.set(dataType, gameData[dataType]);
            });

            [...this.systems, ...agent.systems, agent, debugSystem].forEach(system => system.setup(world));

            const { events } = resources.get();

            events.write({
                name: 'gameStart',
                type: 'all',
            });

            await this.dispatch();
            return this.runLoop();
        },
        onGameEnd(results) {
            if (!results || results.length <= 0) {
                console.warn('The game ended but there is no result data');
            }
            debugEngine(`Average step delay for this game: ${this._totalLoopDelay / world.resources.get().frame.getGameLoop()}`);
            // @TODO: have some option to configure auto-saving of replays
            return [world, results];
        },
        async runLoop() {
            const { events, frame } = world.resources.get();

            if (_client.status !== 3) {
                debugEngine('exiting loop, status no longer in game');
                this.onGameEnd(frame._result);
                // @TODO: check the frame to see if there happens to be some result data?
                throw new GameEndedError('Status no longer in game');
            }

            if (this._lastRequest) {
                this._loopDelay = hrtimeH(process.hrtime(this._lastRequest)).milliseconds;

                /** 
                 * I'd like to keep this here. I think as long as this api is aligned to providing a framework
                 * to get bots onto a ladder (like sc2ai, etc) or into tournaments - the user shouldn't be able
                 * to make a slow, resource draining bot without it being shoved in their face.
                 * 
                 * @TODO: maybe allow this to be configurable? not off... per se, but some threshhold.
                 */
                if (this._loopDelay / STEP_COUNT > 44.6) {
                    // console.warn(`WARNING! loop delay is ${this._loopDelay / STEP_COUNT}ms, greater than realtime`);
                }

                this._totalLoopDelay += this._loopDelay / STEP_COUNT;

                /**
                 * this was here for testing, but we could use it in the future to implement realtime
                 * 
                 * this.loopDelay = hrtimeH(process.hrtime(this.lastRequest)).milliseconds;
                 * const shouldDelay = calculateDelay(this.loopDelay);
                 * debug('delay frame: ', shouldDelay);
                 * //@ts-ignore bogus export default typing issue with `delay` package
                 * await delay(shouldDelay || 0);
                 */
            }

            this._lastRequest = process.hrtime();

            if (process.env.DELAY) {
                await Promise.delay(parseInt(process.env.DELAY, 10));
            }

            await _client.step({ count: STEP_COUNT });

            events.write({
                name: 'step',
                type: 'all',
                data: frame.getGameLoop() + STEP_COUNT,
            });

            try {
                await this.dispatch();
            } catch(e) {
                // @FIXME: this really shouldn't be branched via an error... but it was a quick fix
                if (e instanceof GameEndedError) {
                    // game over dude, we outtie
                    return this.onGameEnd(e.data);
                } else {
                    console.warn('An error of an unknown type has propegated up to the game loop', e);
                    throw e;
                }
            }

            return this.runLoop();
        },
        async dispatch() {
            /**
             * First, run all engine systems, and in series - the 'step' event propegates
             * all other events as well - starting with the frame system that handles digesting
             * the updated frame data.
             */
            const engineSystems = this.systems;
            await Promise.mapSeries(engineSystems, system => system(world)); // concurrency: 1
            
            /**
             * Next let the agent itself consume events -
             * 
             * @FIXME: this is a lot of duplicated logic from the system wrapper...
             * maybe an agent itself should just be a glorified system? alternative
             * is that it's time to break the dispatcher out into an actual entity
             * instead of just this engine function.
             */ 

            const { agent, resources } = world;
            const { events } = resources.get();
            const eventsWithHandlers = events.read(agent.readerId).filter(event => agent[`on${pascalCase(event.name)}`]);
            const handlerPromises = eventsWithHandlers.length > 0 ?
                eventsWithHandlers.map((event) => {
                    return agent[`on${pascalCase(event.name)}`](world, event.data, event)
                        .catch((err) => {
                            if (err instanceof NodeSC2Error) {
                                debugSilly(`Agent handler error: on${pascalCase(event.name)}: `, err);
                            } else {
                                console.warn(`Agent handler error: on${pascalCase(event.name)}: `);
                                debugEngine(err.message);
                                debugEngine(err.stack);
                            }
                        });
                }) :
                [];

            await Promise.all(handlerPromises);

            /**
             * @TODO: Should agent systems always be run concurrently? 
             * 
             * i fear making this configurable because it could cause massive 
             * perf issues with a ton of systems all potentially awaiting transport.
             * On the other hand - it would create a huge amount of flexibility to
             * allow systems to define their other system dependencies... such as acting
             * on entities with certain labels after they have been assigned/removed
             * by other systems that frame.
             */
            const { agent: { systems } } = world;
            await Promise.map(systems, system => system(world));

            // debug system runs last because it updates the in-client debug display
            return debugSystem(world);
        },
        _lastRequest: null,
    };

    engine.use([
        frameSystem,
        unitSystem,
        mapSystem,
    ]);

    return engine;
}
972570
def serve(self, host='127.0.0.1', port=5000):
        """"""
        from meinheld import server, middleware
        # self.app.run(host=host, port=port)
        server.listen((host, port))
        server.run(middleware.WebSocketMiddleware(self.app))
646668
def _run_cwltool(args):
    
    main_file, json_file, project_name = _get_main_and_json(args.directory)
    work_dir = utils.safe_makedir(os.path.join(os.getcwd(), "cwltool_work"))
    tmp_dir = utils.safe_makedir(os.path.join(work_dir, "tmpcwl"))
    log_file = os.path.join(work_dir, "%s-cwltool.log" % project_name)
    os.environ["TMPDIR"] = tmp_dir
    flags = ["--tmpdir-prefix", tmp_dir, "--tmp-outdir-prefix", tmp_dir]
    if args.no_container:
        _remove_bcbiovm_path()
        flags += ["--no-container", "--preserve-environment", "PATH", "--preserve-environment", "HOME"]
    cmd = ["cwltool"] + flags + args.toolargs + ["--", main_file, json_file]
    with utils.chdir(work_dir):
        _run_tool(cmd, not args.no_container, work_dir, log_file=log_file)