/*
Call method of trumbowyg if exist
else try to call anonymous function
and finally native execCommand
435850
function (cmd, param, forceCss, skipTrumbowyg) {
            var t = this;
            skipTrumbowyg = !!skipTrumbowyg || '';

            if (cmd !== 'dropdown') {
                t.$ed.focus();
            }

            try {
                t.doc.execCommand('styleWithCSS', false, forceCss || false);
            } catch (c) {
            }

            try {
                t[cmd + skipTrumbowyg](param);
            } catch (c) {
                try {
                    cmd(param);
                } catch (e2) {
                    if (cmd === 'insertHorizontalRule') {
                        param = undefined;
                    } else if (cmd === 'formatBlock' && t.isIE) {
                        param = '<' + param + '>';
                    }

                    t.doc.execCommand(cmd, false, param);

                    t.syncCode();
                    t.semanticCode(false, true);
                }

                if (cmd !== 'dropdown') {
                    t.updateButtonPaneStatus();
                    t.$c.trigger('tbwchange');
                }
            }
        }
905013
function exec(inst, raw, argv, event, fin) {
    var after = nextup(inst, raw, argv, event, fin);
    return step(inst, raw, argv, event, passthrough(after));
}
1349918
function run(cmd) {
  try {
    if (isWindows)
      cmd = 'cmd /C ' + cmd;
    var code = shell.exec(cmd);
    return code;
  } catch (err) {
    if (err) {
      console.error(err)
    }
    return 1;
  }
}
202429
function processExecCommand (obj) {
        console.assert(obj);
        try {
          if (obj.type === TNMT$1.AddExecCommandQueueSuccess) {
            __agent.log(logCord$7, 'add exec command queue success and start after!');
            var queueID = obj.queueInfo.id;
            $bc_$16.sendQueueEvent(queueID, 'execcommand', 'start');
            __mc.trigger(TypeMsg$6.onExecCommandAdded, {
              data: obj
            });
          } else if (obj.type === TNMT$1.ExecCommandStart) {
            __agent.log(logCord$7, 'exec command start ...');
            __mc.trigger(TypeMsg$6.onExecCommandStarted, {
              data: obj
            });
          } else if (obj.type === TNMT$1.ExecCommandReportProgress) {
            __agent.log(logCord$7, 'report exec command progress ...');
            __mc.trigger(TypeMsg$6.onExecCommandFeedback, {
              data: obj
            });
          } else if (obj.type === TNMT$1.ExecCommandSuccess) {
            __agent.log(logCord$7, 'exec command success ...');
            __mc.trigger(TypeMsg$6.onExecCommandSuccess, {
              data: obj
            });
          } else if (obj.type === TNMT$1.CancelExecCommand) {
            __agent.log(logCord$7, 'exec command cancel ...');
            __mc.trigger(TypeMsg$6.onExecCommandCanceled, {
              data: obj
            });
          } else if (obj.type === TNMT$1.ExecCommandFailed) {
            __agent.log(logCord$7, 'exec command error ...');
            __mc.trigger(TypeMsg$6.onExecCommandError, {
              data: obj
            });
          }
        } catch (error) {
          console.error(logCord$7, error);
        }
      }
74538
function checkCommand (command, errorCallback) {
    var exec = command
    var args = this.argsExecutable
    var shell = false
    if (this.win) {
      // Arguments have to be manually quoted
      exec = `"${exec}"`
      args = args.map(a => `"${a}"`)
      shell = true
    }

    this.log.verbose(`- executing "${command}" to get executable path`)
    this.run(exec, args, shell, function (err, execPath) {
      // Possible outcomes:
      // - Error: not in PATH, not executable or execution fails
      // - Gibberish: the next command to check version will fail
      // - Absolute path to executable
      if (err) {
        this.addLog(`- "${command}" is not in PATH or produced an error`)
        return errorCallback(err)
      }
      this.addLog(`- executable path is "${execPath}"`)
      this.checkExecPath(execPath, errorCallback)
    }.bind(this))
  }
524568
function ExitHandler( exiting, error ) {
	if( error ) {
		if( error.stack ) {
			console.error( error.stack );
		}

		process.exit( 1 );
	}

	if( exiting.now ) {
		process.exit( 0 ); // exit now
	}

	console.log('\n');

	process.exit( 0 ); // now exit with a smile :)
}
805123
def _execCommand(Argv, collect_missing):
  
  """
  if not Argv:
    raise HandledException('Please specify a command!')

  RouteParts = Argv[0].split('/')
  Args, KwArgs = getDigestableArgs(Argv[1:])

  ResolvedMember = getDescendant(BaseGroup, RouteParts[:])

  if isinstance(ResolvedMember, Group):
    raise HandledException('Please specify a task.', Member=ResolvedMember)

  if not isinstance(ResolvedMember, Task):
    raise HandledException('No such task.', Member=BaseGroup)

  return ResolvedMember.__collect_n_call__(*Args, **KwArgs) if collect_missing else ResolvedMember(*Args, **KwArgs)
220164
@Override
    public Object execIdCall(IdFunctionObject f, Context cx, Scriptable scope,
                             Scriptable thisObj, Object[] args)
    {
        if (!f.hasTag(CLASS_NAME)) {
            return super.execIdCall(f, cx, scope, thisObj, args);
        }
        int id = f.methodId();
        switch (id) {
        case ConstructorId_isView:
            return (isArg(args, 0) && (args[0] instanceof NativeArrayBufferView));

        case Id_constructor:
            double length = isArg(args, 0) ? ScriptRuntime.toNumber(args[0]) : 0;
            return new NativeArrayBuffer(length);

        case Id_slice:
            NativeArrayBuffer self = realThis(thisObj, f);
            double start = isArg(args, 0) ? ScriptRuntime.toNumber(args[0]) : 0;
            double end = isArg(args, 1) ? ScriptRuntime.toNumber(args[1]) : self.buffer.length;
            return self.slice(start, end);
        }
        throw new IllegalArgumentException(String.valueOf(id));
    }
1071651
function call($func,$args=NULL,$hooks='') {
		if (!is_array($args))
			$args=array($args);
		// Grab the real handler behind the string representation
		if (is_string($func))
			$func=$this->grab($func,$args);
		// Execute function; abort if callback/hook returns FALSE
		if (!is_callable($func))
			// No route handler
			if ($hooks=='beforeroute,afterroute') {
				$allowed=array();
				if (is_array($func))
					$allowed=array_intersect(
						array_map('strtoupper',get_class_methods($func[0])),
						explode('|',self::VERBS)
					);
				header('Allow: '.implode(',',$allowed));
				$this->error(405);
			}
			else
				user_error(sprintf(self::E_Method,
					is_string($func)?$func:$this->stringify($func)),
					E_USER_ERROR);
		$obj=FALSE;
		if (is_array($func)) {
			$hooks=$this->split($hooks);
			$obj=TRUE;
		}
		// Execute pre-route hook if any
		if ($obj && $hooks && in_array($hook='beforeroute',$hooks) &&
			method_exists($func[0],$hook) &&
			call_user_func_array(array($func[0],$hook),$args)===FALSE)
			return FALSE;
		// Execute callback
		$out=call_user_func_array($func,$args?:array());
		if ($out===FALSE)
			return FALSE;
		// Execute post-route hook if any
		if ($obj && $hooks && in_array($hook='afterroute',$hooks) &&
			method_exists($func[0],$hook) &&
			call_user_func_array(array($func[0],$hook),$args)===FALSE)
			return FALSE;
		return $out;
	}
1115620
function (cmd,context,silent)
		{
			var ctx = (context!=undefined?context:this);
			try
			{
				return (function () {
					var result = eval(cmd);
					if (!silent)
						self.e.log&&self.e.log(util.inspect(result),'result');
					return result;
				}.bind(ctx))();
			} catch (e)
			{
				this.e.exception&&this.e.exception(e);
			}
			return;
		}
1075462
function handler(current, argv) {
        var cmds = pargv._commands;
        var completions = [];
        if (pargv._env.EXEC === argv[0])
            argv.shift(); // remove first arg which is app/exec name.
        var tmpCmd = pargv.getCommand(utils.first(argv)); // is first is known command.
        if (tmpCmd) { // limit to single command if known.
            cmds = {}; // set the commands to just the one known command.
            cmds[tmpCmd._name] = tmpCmd;
            var sliced_1 = argv.slice(1); // remove command name.
            var curCmdIdx_1 = 0;
            var lastCmdIdx_1 = tmpCmd._arguments.length - 1; // last index for commands.
            sliced_1.forEach(function (el, i) {
                if (!constants_1.FLAG_EXP.test(el) && i <= lastCmdIdx_1) {
                    var prev_1 = sliced_1[i - 1] || null;
                    var prevKey = tmpCmd.isOption(prev_1);
                    if (!prevKey && !constants_1.FLAG_EXP.test(prev_1)) // could be val for option.
                        curCmdIdx_1 = i;
                }
            });
            var curIdx = sliced_1.length - 1;
            var prevIdx = sliced_1.length - 2;
            var prev = sliced_1[prevIdx] || null;
            var isFlagPrev = prev && constants_1.FLAG_EXP.test(prev);
            var isBool = tmpCmd.isBool(prev);
            var isOption = isFlagPrev && !isBool;
            var isCommand = (curCmdIdx_1 >= 0) &&
                (curCmdIdx_1 <= lastCmdIdx_1);
            //  !FLAG_EXP.test(sliced[curIdx])
            if (isCommand || isOption) {
                var key = isOption ? tmpCmd.aliasToKey(prev) : tmpCmd.aliasToKey(curCmdIdx_1);
                if (tmpCmd._completions[key])
                    completions = completions.concat(tmpCmd._completions[key]);
            }
            if (tmpCmd._completions['*']) // anon custom completions.
                completions = completions.concat(tmpCmd._completions['*']);
        }
        else {
            var _loop_1 = function (k) {
                var cmd = cmds[k];
                [cmd._name].concat(cmd.aliases(cmd._name) || []) // iterate commands.
                    .forEach(function (el, i) {
                    if (!~completions.indexOf(el))
                        completions.push(el);
                });
                cmd._options.forEach(function (o) {
                    if (!~completions.indexOf(o))
                        completions.push(o);
                    (cmd.aliases(o) || []).forEach(function (el) {
                        if (!~completions.indexOf(el))
                            completions.push(el);
                    });
                });
            };
            for (var k in cmds) {
                _loop_1(k);
            }
        }
        // TODO: clunky redundant need to refactor this.
        var _options = completions.filter(function (c) { return constants_1.FLAG_EXP.test(c); });
        var _cmds = completions.filter(function (c) { return !constants_1.FLAG_EXP.test(c); });
        return _cmds.sort().concat(_options.sort());
    }
109288
function run(exec, args, shell, callback) {
    var env = extend({}, this.env)
    env.TERM = 'dumb'
    const opts = { env: env, shell: shell }

    this.log.silly('execFile: exec = %j', exec)
    this.log.silly('execFile: args = %j', args)
    this.log.silly('execFile: opts = %j', opts)
    try {
      this.execFile(exec, args, opts, execFileCallback.bind(this))
    } catch (err) {
      this.log.silly('execFile: threw:\n%s', err.stack)
      return callback(err)
    }

    function execFileCallback(err, stdout, stderr) {
      this.log.silly('execFile result: err = %j', err && err.stack || err)
      this.log.silly('execFile result: stdout = %j', stdout)
      this.log.silly('execFile result: stderr = %j', stderr)
      if (err) {
        return callback(err)
      }
      const execPath = stdout.trim()
      callback(null, execPath)
    }
  }
167561
function(args, callInstance) {
    handlers.afterFunc({name: callInstance.name}, null, args, callInstance);
  }
952364
public static void callMethod(final Object obj, final String methodName, final Object... args) {
		try {
			callMethod(obj, methodName, false, args);
		} catch (InvocationTargetException e) {
			JK.throww(e);
		}
	}
1297082
function (args, detached, callback) {
  let error, errorEmitted, stderr, stdout

  try {
    // Ensure we don't spawn multiple squirrel processes
    // Process spawned, same args:        Attach events to alread running process
    // Process spawned, different args:   Return with error
    // No process spawned:                Spawn new process
    if (spawnedProcess && !isSameArgs(args)) {
      // Disabled for backwards compatibility:
      // eslint-disable-next-line standard/no-callback-literal
      return callback(`AutoUpdater process with arguments ${args} is already running`)
    } else if (!spawnedProcess) {
      spawnedProcess = spawn(updateExe, args, {
        detached: detached,
        windowsHide: true
      })
      spawnedArgs = args || []
    }
  } catch (error1) {
    error = error1

    // Shouldn't happen, but still guard it.
    process.nextTick(function () {
      return callback(error)
    })
    return
  }
  stdout = ''
  stderr = ''

  spawnedProcess.stdout.on('data', (data) => { stdout += data })
  spawnedProcess.stderr.on('data', (data) => { stderr += data })

  errorEmitted = false
  spawnedProcess.on('error', (error) => {
    errorEmitted = true
    callback(error)
  })

  return spawnedProcess.on('exit', function (code, signal) {
    spawnedProcess = undefined
    spawnedArgs = []

    // We may have already emitted an error.
    if (errorEmitted) {
      return
    }

    // Process terminated with error.
    if (code !== 0) {
      // Disabled for backwards compatibility:
      // eslint-disable-next-line standard/no-callback-literal
      return callback(`Command failed: ${signal != null ? signal : code}\n${stderr}`)
    }

    // Success.
    callback(null, stdout)
  })
}
430282
function (cmd, cb) {
  var internalCmd = internalCommand(cmd);
  if (internalCmd) {
    return cb(['info', internalCmd]);
  }
  $document.trigger('console:run', cmd);
}
1106701
function _executeMethod(method, id, fn, params){
        if (!fn) {
            if (id) {
                _send({
                    id: id,
                    error: {
                        code: -32601,
                        message: "Procedure not found."
                    }
                });
            }
            return;
        }
        
        var success, error;
        if (id) {
            success = function(result){
                success = emptyFn;
                _send({
                    id: id,
                    result: result
                });
            };
            error = function(message, data){
                error = emptyFn;
                var msg = {
                    id: id,
                    error: {
                        code: -32099,
                        message: message
                    }
                };
                if (data) {
                    msg.error.data = data;
                }
                _send(msg);
            };
        }
        else {
            success = error = emptyFn;
        }
        // Call local method
        if (!isArray(params)) {
            params = [params];
        }
        try {
            var result = fn.method.apply(fn.scope, params.concat([success, error]));
            if (!undef(result)) {
                success(result);
            }
        } 
        catch (ex1) {
            error(ex1.message);
        }
    }