Used to invoke executable asynchronously.
170940
public void run() {
		try {
			Object result = execute();
			if (!aborted) {
				this.retval = result;
				finished = true;
			}
		}
		catch (InterruptedException ie) {
			//
		}
		catch (Throwable t) {
			execException = t;
			finished = true;
		}
	}
1254906
def _imperative_invoke(handle, ndargs, keys, vals, out):
    """"""
    if out is not None:
        original_output = out
        if isinstance(out, NDArrayBase):
            out = (out,)
        num_output = ctypes.c_int(len(out))
        output_vars = c_handle_array(out)
        output_vars = ctypes.cast(output_vars, ctypes.POINTER(NDArrayHandle))
    else:
        original_output = None
        output_vars = ctypes.POINTER(NDArrayHandle)()
        num_output = ctypes.c_int(0)

    # return output stypes to avoid the c_api call for checking
    # a handle's stype in _ndarray_cls
    out_stypes = ctypes.POINTER(ctypes.c_int)()

    check_call(_LIB.MXImperativeInvokeEx(
        ctypes.c_void_p(handle),
        ctypes.c_int(len(ndargs)),
        c_handle_array(ndargs),
        ctypes.byref(num_output),
        ctypes.byref(output_vars),
        ctypes.c_int(len(keys)),
        c_str_array(keys),
        c_str_array([str(s) for s in vals]),
        ctypes.byref(out_stypes)))

    if original_output is not None:
        return original_output
    if num_output.value == 1:
        return _ndarray_cls(ctypes.cast(output_vars[0], NDArrayHandle),
                            stype=out_stypes[0])
    else:
        return [_ndarray_cls(ctypes.cast(output_vars[i], NDArrayHandle),
                             stype=out_stypes[i])
                for i in range(num_output.value)]
1159378
def _invoke(self, *params):
		
		cmd = [self.exe, '-R', self.location] + list(params)
		with reentry.in_process_context(cmd) as result:
			sys.modules['mercurial.dispatch'].run()
		stdout = result.stdio.stdout.getvalue()
		stderr = result.stdio.stderr.getvalue()
		if not result.returncode == 0:
			raise RuntimeError(stderr.strip() or stdout.strip())
		return stdout.decode('utf-8')
1340448
function invoke(argv_, fn, msg) {
  var argv = argv_;

  if (_.isFunction(argv.getParams)) {
    argv = argv.getParams({});
  }

  if (argv.ra_file) {
    let jsonfile = argv.ra_file;
    argv = require(jsonfile);
  }

  var params    = {};
  params.params = _.omit(argv, 'args');

  _.each(argv.args, function(arg, n) {
    params.params['arg'+n] = arg;
  });

  var spec      = {};
  return ra.invoke(params, spec, fn, function(err) {
    var exitCode = 0;

    if (err) {
      exitCode = 1;
      console.error(err, "Error invoking: "+msg);
    }

    if (arguments.length === 1) {
      process.exit(exitCode);
      return;
    }

    if (arguments.length === 2) {
      if (_.isString(arguments[1])) {
        process.stdout.write(arguments[1]+'\n');
      } else {
        process.stdout.write(JSON.stringify(arguments[1])+'\n');
      }
      return;
    }

    /* otherwise */
    process.stdout.write(JSON.stringify(_.rest(arguments))+'\n');
    process.exit(exitCode);
  });
}
532488
public void invokestatic(ExecutableElement method) throws IOException
    {
        int index = subClass.resolveMethodIndex(method);
        invokestatic(index);
    }
221821
function executable(value) {
      var result;
      try {
        result = resolve(task.apply(this, arguments));
      } catch (e) {
        result = reject(e);
      }
      return result;
    }
348087
def run(cmd, input=None, capture_output=False, check=False, quiet=False, **kwargs):
    """"""
    if input is not None:
        kwargs['stdin'] = subprocess.PIPE
    if capture_output:
        kwargs['stdout'] = kwargs['stderr'] = subprocess.PIPE

    try:
        proc = subprocess.Popen(cmd, startupinfo=get_startupinfo(), **kwargs)
    except OSError as e:
        if e.errno == errno.ENOENT:
            raise ExecutableNotFound(cmd)
        else:
            raise

    out, err = proc.communicate(input)

    if not quiet and err:
        stderr_write_bytes(err, flush=True)
    if check and proc.returncode:
        raise CalledProcessError(proc.returncode, cmd, output=out, stderr=err)

    return out, err
273247
def _invoke(task, args):
	''''''
	kwargs = task.defaults.copy()
	if task.kwargs:
		temp_kwargs, args = getopt.getopt(args, '', task.kwargs)
		temp_kwargs = _opts_to_dict(*temp_kwargs)
		kwargs.update(temp_kwargs)

	if task.args:
		for arg in task.args:
			if not len(args):
				abort(LOCALE['error_wrong_args'], task, len(task.args))
			kwargs.update({arg: args[0]})
			args = args[1:]

	if task.consume:
		task(*args, **kwargs)
		return []
	else:
		task(**kwargs)
		return args
897864
function invoke() {

        global $SESSION;

        // Sesskey protection
        if ($this->sesskey_protected) {
            require_sesskey();
        }

        // If we are used any dir, save it in the lastused session object
        // Some actions can use it to perform positioning
        if ($lastused = optional_param ('dir', NULL, PARAM_PATH)) {
            $SESSION->lastused = $lastused;
        }

        $this->postaction = optional_param ('postaction', NULL, PARAM_ALPHAEXT);
        // Avoid being recursive
        if ($this->title == $this->postaction) {
            $this->postaction = NULL;
        }
    }
624766
@Override
	public final void invoke() {
		if (index < inters.length)
			inters[index++].intercept(this);
		else if (index++ == inters.length)
			invocation.invoke();
	}
498964
def run(self):
        ''''''
        while not self.wait(self.delay()):
            try:
                logger.info('Invoking callback %s', self.callback)
                self.callback()
            except StandardError:
                logger.exception('Callback failed')
230314
function execute() {
  var context = getDefaultContext();
  var compiledOutput = fs.readFileSync(this.outputPath)

  vm.runInContext(compiledOutput, context, this.outputPath);

  var module = extractModule(this.moduleName, context);

  this.compiledModule = context.Elm.fullscreen(module, this.defaults);
}
481277
def execute_with_lock(self, executable: str, lock: ConnectedConsulLockInformation, *, capture_stdout: bool=False,
                          capture_stderr: bool=False) -> Tuple[int, Optional[bytes], Optional[bytes]]:
        
        assert lock is not None
        redirects = Munch(stdout=subprocess.PIPE if capture_stdout else sys.stdout,
                         stderr=subprocess.PIPE if capture_stderr else sys.stderr)

        # Patch for when sys.stdout and sys.stderr have been reassigned (e.g. in IDE test runners)
        non_realtime_redirects: Dict[str, StringIO] = {}
        for name, redirect in redirects.items():
            if isinstance(redirect, StringIO):
                logger.warning(f"Cannot capture {name} in real-time as `sys.{name}` does not have a fileno")
                non_realtime_redirects[name] = redirect
                redirects[name] = subprocess.PIPE

        outputs = Munch(stdout=None, stderr=None)
        with lock:
            process = subprocess.Popen(executable, shell=True, stdout=redirects.stdout, stderr=redirects.stderr)
            outputs.stdout, outputs.stderr = process.communicate()

        # Second part of redirect reassignment patch
        for name, original_redirect in non_realtime_redirects.items():
            captured = outputs[name]
            getattr(sys, name).write(captured.decode("utf-8"))

        return process.returncode, \
               outputs.stdout if capture_stdout else None, \
               outputs.stderr if capture_stderr else None
976564
def _invoke_callbacks(self):
        """"""
        self.task_end_time = time.time()
        self.task_cost_time = self.task_end_time - self.task_start_time
        with self._condition:
            for callback in self._done_callbacks:
                try:
                    result = callback(self)
                    if callback in self._user_callbacks:
                        self._callback_result = result
                except Exception as e:
                    Config.main_logger.error("exception calling callback for %s" % e)
            self._condition.notify_all()
301129
async function runProgram() {
    let argvFragment = process.argv.slice(2);
    if (argvFragment.length === 0) {
        argvFragment = ['-h'];
    }

    const latest = await latestVersion(pkg.name, {version: `>${pkg.version}`})
        .catch(() => pkg.version);
    if (semver.gt(latest, pkg.version)) {
        process.stderr.write(chalk.default.white(`\n     Update available `));
        process.stderr.write(chalk.default.grey(`${pkg.version}`));
        process.stderr.write(chalk.default.white(` -> `));
        process.stderr.write(chalk.default.greenBright(`${latest}\n`));
        process.stderr.write(chalk.default.white(`     Run `));
        process.stderr.write(chalk.default.blueBright(`npm i -g ${pkg.name} `));
        process.stderr.write(chalk.default.white(`to update.\n\n`));
    }

    args = minimist(argvFragment);

    if (args.prefix) {
        intercept(function (txt) {
            return `[${pkg.name}]\n${txt}`;
        });
    }

    if (args['!'] ||
        args.help ||
        args.h ||
        args._.includes('help')) {
        return help(args, process.stdout);
    }


    if (args._.length === 1 && args._[0] === 'init') {
        const result = await initializeConfig();
        if (result) {
            await stdoutAsync(`Successfully wrote ${process.cwd()}/.qnamakerrc\n`);
        }
        return;
    }

    if (args.version || args.v) {
        await stdoutAsync(require(path.join(__dirname, '../package.json')).version + '\n');
        return;
    }

    let serviceIn = {};
    if (args.stdin) {
        let json = await stdin();
        serviceIn = JSON.parse(json);
    }

    const config = await composeConfig(args);
    args.kbId = args.kbId || serviceIn.kbId || config.kbId;
    args.subscriptionKey = args.subscriptionKey || serviceIn.subscriptionKey || config.subscriptionKey;
    args.endpointKey = args.endpointKey || serviceIn.endpointKey || config.endpointKey;
    args.hostname = args.hostname || serviceIn.hostname || config.hostname;

    ServiceBase.config = args;

    validateConfig(args);

    if (args._[0] === 'set')
        return await handleSetCommand(args, config);

    const serviceManifest = getServiceManifest(args);

    let requestBody = await validateArguments(serviceManifest);

    // special case operations
    switch (serviceManifest.operation.methodAlias) {
        case 'delete':
            if (!args.f && !args.force) {
                let kbResult = await new Knowledgebase().getKnowledgebaseDetails(config);
                let kb = JSON.parse(await kbResult.text());
                if (!args.force) {
                    let answer = readlineSync.question(`Are you sure you would like to delete ${kb.name} [${kb.id}]? [no] `, {defaultInput: 'no'});
                    if (answer.trim()[0] === 'n') {
                        process.stderr.write('operation canceled');
                        return;
                    }
                }
            }
            break;

        case 'create':
            if (args.name)
                requestBody.name = args.name;

            if (!requestBody.name) {
                if (!(args.q || args.quiet)) {
                    let answer = readlineSync.question(`What would you like to name your new knowledgebase? `);
                    if (answer && answer.length > 0)
                        requestBody.name = answer.trim();
                }
            }
            // hack to map incorrect export property from expected import.  Export uses qnaDocuments, create/update/replace qnaList :(
            if (requestBody.qnaDocuments && !requestBody.qnaList) {
                requestBody.qnaList = requestBody.qnaDocuments;
                delete requestBody.qnaDocuments;
            }
            break;

        case 'replace':
        case 'update':
            // hack to map incorrect export property from expected.  Export uses qnaDocuments, create/update/replace qnaList :(
            if (requestBody.qnaDocuments && !requestBody.qnaList) {
                requestBody.qnaList = requestBody.qnaDocuments;
                delete requestBody.qnaDocuments;
            }
            break;
    }

    let result = await qnamaker(config, serviceManifest, args, requestBody);
    if (result.error) {
        throw new Error(JSON.stringify(result.error, null, 4));
    }

    // special case response
    switch (serviceManifest.operation.name) {
        case 'getKnowledgebaseDetails': {
            config.kbId = result.id;
            let kb = await updateKbId(config);
            if (args.msbot) {
                await stdoutAsync(JSON.stringify({
                    type: 'qna',
                    name: kb.name,
                    id: kb.id,
                    kbId: kb.id,
                    subscriptionKey: config.subscriptionKey,
                    endpointKey: config.endpointKey,
                    hostname: kb.hostName
                }, null, 2) + '\n');
            } else {
                await stdoutAsync(JSON.stringify(result, null, 2) + '\n');
            }
            break;
        }
        case 'createKnowledgebase':
            if (args.wait || args.msbot) {
                result = await waitForOperationSucceeded(config, result);

                let kbId = result.resourceLocation.split('/')[2];
                config.kbId = kbId;
                let kb = await updateKbId(config);
                if (args.msbot) {
                    await stdoutAsync(JSON.stringify({
                        type: 'qna',
                        name: kb.name,
                        id: kb.id,
                        kbId: kb.id,
                        subscriptionKey: config.subscriptionKey,
                        endpointKey: config.endpointKey,
                        hostname: config.hostname
                    }, null, 2) + '\n');

                } else {
                    await stdoutAsync(JSON.stringify(result, null, 2));
                }
                if (args.wait && !(args.q || args.quiet) && !args.msbot) {
                    let answer = readlineSync.question(`Would you like to save ${kb.name} ${kb.id} in your .qnamakerrc so that future commands will be with this KB? [yes] `, {defaultInput: 'yes'});
                    if (answer[0] === 'y') {
                        await fs.writeJson(path.join(process.cwd(), '.qnamakerrc'), config, {spaces: 2});
                        await stdoutAsync('.qnamakerrc updated' + '\n');
                    }
                }
            } else {
                await stdoutAsync(JSON.stringify(result, null, 2));
            }
            break;

        case 'updateKnowledgebase':
            if (args.wait || args.msbot) {
                result = await waitForOperationSucceeded(config, result);
            }
            await stdoutAsync(JSON.stringify(result, null, 2));
            break;

        default: {
            // dump json as json stringified
            if (typeof result === 'string')
                await stdoutAsync(result + '\n');
            else
                await stdoutAsync(JSON.stringify(result, null, 2) + '\n');
            break;
        }
    }
}
340393
protected synchronized void invoke()
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "invoke");
      try
      {
         // Pass details to implementor's conversation receive listener.
         if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) JFapUtils.debugTraceWsByteBuffer(this, tc, data, 16, "data passed to dataReceived method");
         listener.dataReceived(data,
                               segmentType,
                               requestNumber,
                               priority,
                               allocatedFromPool,
                               partOfExchange,
                               conversation);
      }
      catch(Throwable t)
      {
         FFDCFilter.processException
            (t, "com.ibm.ws.sib.jfapchannel.impl.rldispatcher.ReceiveListenerDataReceivedInvocation", JFapChannelConstants.RLDATARECEIVEDINVOKE_INVOKE_01);
         if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "exception thrown by dataReceived");
         if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.exception(this, tc, t);

         // User has thrown an exception from data received method.  Probably
         // the best way to deal with this is to invalidate their connection.
         // That'll learn 'em.
         connection.invalidate(true, t, "exception thrown by dataReceived - "+t.getLocalizedMessage());  // D224570

      }

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "invoke");
   }
1166708
def run(*args, **kwargs):
    '''
    
    '''
    lib = sys.modules[asynclib.lib_name]
    lib.run(*args, **kwargs)