Lines Matching refs:cmd
45 void StripShellComment(string* cmd) { in StripShellComment() argument
46 if (cmd->find('#') == string::npos) in StripShellComment()
56 const char* in = cmd->c_str(); in StripShellComment()
94 cmd->swap(res); in StripShellComment()
486 static bool HasNoIoInShellScript(const string& cmd) { in HasNoIoInShellScript() argument
487 if (cmd.empty()) in HasNoIoInShellScript()
489 if (HasPrefix(cmd, "echo $((") && cmd[cmd.size()-1] == ')') in HasNoIoInShellScript()
494 static void ShellFuncImpl(const string& shell, const string& cmd, in ShellFuncImpl() argument
496 LOG("ShellFunc: %s", cmd.c_str()); in ShellFuncImpl()
504 if ((*fc)->Parse(cmd)) { in ShellFuncImpl()
506 if (FindEmulator::Get()->HandleFind(cmd, **fc, &out2)) { in ShellFuncImpl()
510 if (FindEmulator::Get()->HandleFind(cmd, **fc, s)) { in ShellFuncImpl()
519 COLLECT_STATS_WITH_SLOW_REPORT("func shell time", cmd.c_str()); in ShellFuncImpl()
520 RunCommand(shell, cmd, RedirectStderr::NONE, s); in ShellFuncImpl()
527 cmd.c_str(), s->c_str(), out2.c_str()); in ShellFuncImpl()
535 bool ShouldStoreCommandResult(StringPiece cmd) { in ShouldStoreCommandResult() argument
536 if (HasWord(cmd, "date") || HasWord(cmd, "echo")) in ShouldStoreCommandResult()
541 for (StringPiece tok : WordScanner(cmd)) { in ShouldStoreCommandResult()
551 string cmd = args[0]->Eval(ev); in ShellFunc() local
552 if (ev->avoid_io() && !HasNoIoInShellScript(cmd)) { in ShellFunc()
556 LOCF(ev->loc()), cmd.c_str()); in ShellFunc()
558 StripShellComment(&cmd); in ShellFunc()
560 *s += cmd; in ShellFunc()
569 ShellFuncImpl(shell, cmd, &out, &fc); in ShellFunc()
570 if (ShouldStoreCommandResult(cmd)) { in ShellFunc()
572 cr->cmd = cmd; in ShellFunc()