@summary: Evaluate Tcl command.

        @param command: command to evaluate.
        @return: command output.
432209
def eval(self, command):
        
        # Some operations (like take ownership) may take long time.
        con_command_out = self._con.send_cmd(command, timeout=256)
        if 'ERROR_SEND_CMD_EXIT_DUE_TO_TIMEOUT' in con_command_out:
            raise Exception('{} - command timeout'.format(command))
        command = command.replace('\\', '/')
        con_command_out = con_command_out.replace('\\', '/')
        command = command.replace('(', '\(').replace(')', '\)')
        command = command.replace('{', '\{').replace('}', '\}')
        m = re.search(command + '(.*)' + '%', con_command_out, re.DOTALL)
        command_out = m.group(1).strip()
        if 'couldn\'t read file' in command_out or 'RuntimeError' in command_out:
            raise Exception(command_out)
        return command_out
73114
def executeCommand(self, command):
        
        if not command.strip():
            return self.waitForInput()
        
        # store the current block
        self._history.append(command)
        self._currentHistoryIndex = len(self._history)
        
        lines = []
        for line in command.split('\n'):
            line = re.sub('^>>> ', '', line)
            line = re.sub('^\.\.\. ', '', line)
            lines.append(line)
        
        command = '\n'.join(lines)
        
        # ensure we are at the end
        self.moveCursor(QTextCursor.End)
        self.scrollToEnd()
        self.insertPlainText('\n')
        cmdresult = None
        
        try:
            cmdresult = eval(command, self.scope(), self.scope())
        
        except SyntaxError:
            exec(command) in self.scope(), self.scope()
        
        else:
            if cmdresult is not None:
                # check to see if the command we executed actually caused
                # the destruction of this object -- if it did, then
                # the commands below will error
                if self.isDestroyed():
                    return
                
                try:
                    result = projex.text.nativestring(repr(cmdresult))
                except:
                    result = '<<< error formatting result to utf-8 >>>'
                
                self.information(result)
        
        finally:
            self.waitForInput()
612289
def layer(command=None, *args):
    ''
    if not command:
        return eval([['hint', 'layer']])  # fall back to buildin layer macro
    else:
        lst = [['layer']]
        for arg in args:
            lst.append([command, arg])
            lst.append(['layer'])
        return eval(lst)
1220973
def exec_output(cls, command, shell=True, encoding='utf-8'):
        
        proc = Popen(command, shell=shell, stdout=PIPE)
        stdout, _stderr = proc.communicate()
        if proc.returncode == 0:
            return stdout.decode(encoding)

        return ''
667712
def run_command(self, command, arg=None, is_eval=False):
        
        mode = is_eval and 'eval' or 'command'

        if isinstance(arg, tuple):
            name, d = arg
        else:
            name, d = arg, {}

        result = getattr(self.connection.admin, mode)(command, name, **d)
        return result
28311
protected Pair<Integer, InputStream> executeCommand(String command) {
        int resultVal = 1;
        InputStream inputStream = null;
        try {
            logger.debug("Executing command: {}", command);
            Process process =  Runtime.getRuntime().exec(command);

            resultVal = process.waitFor();
            inputStream = process.getInputStream();

        } catch (InterruptedException e) {
            logger.info("Execution of {} failed: code - {} ; message - {}", command, resultVal, e.getMessage());
            Thread.currentThread().interrupt();
        } catch (IOException  e) {
            logger.info("Execution of {} failed: code - {} ; message - {}", command, resultVal, e.getMessage());
        }
        if (inputStream == null) {
           // Create an empty InputStream instead of returning a null
           inputStream = new InputStream() {
               @Override
               public int read() throws IOException {
                   return -1;
               }
           } ;
        }
        return new Pair<>(resultVal, inputStream);
    }
244251
def command():
        
        return (
            OneOrMore(
                Word(approved_printables+' ').setResultsName('command',
                    listAllMatches=True) ^
                Grammar.__command_input_output.setResultsName('_in',
                    listAllMatches=True)
                )
            )
152982
def command?(command)
      MakeMakefile::Logging.instance_variable_set :@logfile, File::NULL
      MakeMakefile::Logging.quiet = true
      MakeMakefile.find_executable command.to_s
    end
1182598
public static List<String> cmd(String command) throws IOException, InterruptedException {
        return cmd(command.split(" "));
    }
359250
private String executeCommand(String command) {
        System.out.println("Execute: " + command);

        StringBuilder output = new StringBuilder();
        Process       p;
        try {
            p = Runtime.getRuntime().exec(command);
            p.waitFor();
            BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
            String         line;
            while ((line = reader.readLine()) != null) {
                output.append(line).append("\n");
            }
        } catch (Exception e) {
            throw new WebpIOException(e);
        }
        if (!"".equals(output.toString())) {
            System.out.println("Output: " + output);
        }
        return "";
    }
401942
def command(self):
        """"""
        if not self._command_calculated:

            self._command_calculated = True
            if self.operation == 'command':
                try:
                    command_idx = self.split_tokens.index('command:')
                    command = self.split_tokens[command_idx + 1]
                    if command == '{':
                        # workaround for <= 2.2 log files,
                        # where command was not listed separately
                        command = self.split_tokens[command_idx + 2][:-1]
                    self._command = command.lower()
                except ValueError:
                    pass

        return self._command
946717
def check_command(self, command):
        

        # Use `command` to see if command is callable, store exit code
        code = os.system("command -v {0} >/dev/null 2>&1 || {{ exit 1; }}".format(command))

        # If exit code is not 0, report which command failed and return False, else return True
        if code != 0:
            print("Command is not callable: {0}".format(command))
            return False
        else:
            return True
1238015
def command(self, command):
        
        return self._conn.command('[con_id="{}"] {}'.format(self.id, command))
1229919
public void runCommand(String command) throws Exception {
        String result = "";
        String extras = "export PYTHONWARNINGS=\"ignore:Unverified HTTPS request\" && ";

        Channel channel = session.openChannel("exec");
        ((ChannelExec) channel).setCommand(extras + command);

        channel.setInputStream(null);
        ((ChannelExec) channel).setErrStream(System.err);

        InputStream in = channel.getInputStream();

        ((ChannelExec) channel).setPty(true);

        channel.connect();

        byte[] tmp = new byte[1024];
        while (true) {
            while (in.available() > 0) {
                int i = in.read(tmp, 0, 1024);
                if (i < 0) {
                    break;
                }
                result = result + new String(tmp, 0, i);
            }
            this.result = result;
            this.setResult(result);

            if (channel.isClosed()) {
                if (in.available() > 0) {
                    continue;
                }
                this.exitStatus = channel.getExitStatus();
                break;
            }
            try {
                Thread.sleep(1000);
            } catch (Exception ee) {
            }
        }

        channel.disconnect();
    }
1152143
def exec(*commands)
      ret = ''
      commands.each { |cmd| ret += shell.exec(cmd) }
      ret + shell.exec('exec')
    end
1311181
public Object evaluate(Input input) {
		if (noInput(input)) {
			return NO_INPUT;
		}

		String line = input.words().stream().collect(Collectors.joining(" ")).trim();
		String command = findLongestCommand(line);

		List<String> words = input.words();
		if (command != null) {
			MethodTarget methodTarget = methodTargets.get(command);
			Availability availability = methodTarget.getAvailability();
			if (availability.isAvailable()) {
				List<String> wordsForArgs = wordsForArguments(command, words);
				Method method = methodTarget.getMethod();

				Thread commandThread = Thread.currentThread();
				Object sh = Signals.register("INT", () -> commandThread.interrupt());
				try {
					Object[] args = resolveArgs(method, wordsForArgs);
					validateArgs(args, methodTarget);

					return ReflectionUtils.invokeMethod(method, methodTarget.getBean(), args);
				}
				catch (UndeclaredThrowableException e) {
					if (e.getCause() instanceof InterruptedException || e.getCause() instanceof ClosedByInterruptException) {
						Thread.interrupted(); // to reset interrupted flag
					}
					return e.getCause();
				}
				catch (Exception e) {
					return e;
				}
				finally {
					Signals.unregister("INT", sh);
				}
			}
			else {
				return new CommandNotCurrentlyAvailable(command, availability);
			}
		}
		else {
			return new CommandNotFound(words);
		}
	}
777388
public static void exec_command(String command) throws IOException {
        launchProcess(command, new HashMap<String, String>(), false);
    }