Shell.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577
  1. /*
  2. * Copyright (c) 2020-2022, the SerenityOS developers.
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include "Job.h"
  8. #include "Parser.h"
  9. #include <AK/Array.h>
  10. #include <AK/CircularQueue.h>
  11. #include <AK/DeprecatedString.h>
  12. #include <AK/HashMap.h>
  13. #include <AK/StackInfo.h>
  14. #include <AK/StringBuilder.h>
  15. #include <AK/StringView.h>
  16. #include <AK/Types.h>
  17. #include <AK/Vector.h>
  18. #include <LibCore/Notifier.h>
  19. #include <LibCore/Object.h>
  20. #include <LibLine/Editor.h>
  21. #include <LibMain/Main.h>
  22. #include <termios.h>
  23. #define ENUMERATE_SHELL_BUILTINS() \
  24. __ENUMERATE_SHELL_BUILTIN(alias) \
  25. __ENUMERATE_SHELL_BUILTIN(where) \
  26. __ENUMERATE_SHELL_BUILTIN(cd) \
  27. __ENUMERATE_SHELL_BUILTIN(cdh) \
  28. __ENUMERATE_SHELL_BUILTIN(pwd) \
  29. __ENUMERATE_SHELL_BUILTIN(type) \
  30. __ENUMERATE_SHELL_BUILTIN(exec) \
  31. __ENUMERATE_SHELL_BUILTIN(exit) \
  32. __ENUMERATE_SHELL_BUILTIN(export) \
  33. __ENUMERATE_SHELL_BUILTIN(glob) \
  34. __ENUMERATE_SHELL_BUILTIN(unalias) \
  35. __ENUMERATE_SHELL_BUILTIN(unset) \
  36. __ENUMERATE_SHELL_BUILTIN(history) \
  37. __ENUMERATE_SHELL_BUILTIN(umask) \
  38. __ENUMERATE_SHELL_BUILTIN(not ) \
  39. __ENUMERATE_SHELL_BUILTIN(dirs) \
  40. __ENUMERATE_SHELL_BUILTIN(pushd) \
  41. __ENUMERATE_SHELL_BUILTIN(popd) \
  42. __ENUMERATE_SHELL_BUILTIN(setopt) \
  43. __ENUMERATE_SHELL_BUILTIN(shift) \
  44. __ENUMERATE_SHELL_BUILTIN(source) \
  45. __ENUMERATE_SHELL_BUILTIN(time) \
  46. __ENUMERATE_SHELL_BUILTIN(jobs) \
  47. __ENUMERATE_SHELL_BUILTIN(disown) \
  48. __ENUMERATE_SHELL_BUILTIN(fg) \
  49. __ENUMERATE_SHELL_BUILTIN(bg) \
  50. __ENUMERATE_SHELL_BUILTIN(wait) \
  51. __ENUMERATE_SHELL_BUILTIN(dump) \
  52. __ENUMERATE_SHELL_BUILTIN(kill) \
  53. __ENUMERATE_SHELL_BUILTIN(noop) \
  54. __ENUMERATE_SHELL_BUILTIN(break) \
  55. __ENUMERATE_SHELL_BUILTIN(continue) \
  56. __ENUMERATE_SHELL_BUILTIN(argsparser_parse)
  57. #define ENUMERATE_SHELL_OPTIONS() \
  58. __ENUMERATE_SHELL_OPTION(inline_exec_keep_empty_segments, false, "Keep empty segments in inline execute $(...)") \
  59. __ENUMERATE_SHELL_OPTION(verbose, false, "Announce every command that is about to be executed") \
  60. __ENUMERATE_SHELL_OPTION(invoke_program_for_autocomplete, false, "Attempt to use the program being completed itself for autocompletion via --complete")
  61. #define ENUMERATE_SHELL_IMMEDIATE_FUNCTIONS() \
  62. __ENUMERATE_SHELL_IMMEDIATE_FUNCTION(concat_lists) \
  63. __ENUMERATE_SHELL_IMMEDIATE_FUNCTION(length) \
  64. __ENUMERATE_SHELL_IMMEDIATE_FUNCTION(length_across) \
  65. __ENUMERATE_SHELL_IMMEDIATE_FUNCTION(remove_suffix) \
  66. __ENUMERATE_SHELL_IMMEDIATE_FUNCTION(remove_prefix) \
  67. __ENUMERATE_SHELL_IMMEDIATE_FUNCTION(regex_replace) \
  68. __ENUMERATE_SHELL_IMMEDIATE_FUNCTION(filter_glob) \
  69. __ENUMERATE_SHELL_IMMEDIATE_FUNCTION(split) \
  70. __ENUMERATE_SHELL_IMMEDIATE_FUNCTION(join) \
  71. __ENUMERATE_SHELL_IMMEDIATE_FUNCTION(value_or_default) \
  72. __ENUMERATE_SHELL_IMMEDIATE_FUNCTION(assign_default) \
  73. __ENUMERATE_SHELL_IMMEDIATE_FUNCTION(error_if_empty) \
  74. __ENUMERATE_SHELL_IMMEDIATE_FUNCTION(null_or_alternative) \
  75. __ENUMERATE_SHELL_IMMEDIATE_FUNCTION(defined_value_or_default) \
  76. __ENUMERATE_SHELL_IMMEDIATE_FUNCTION(assign_defined_default) \
  77. __ENUMERATE_SHELL_IMMEDIATE_FUNCTION(error_if_unset) \
  78. __ENUMERATE_SHELL_IMMEDIATE_FUNCTION(null_if_unset_or_alternative) \
  79. __ENUMERATE_SHELL_IMMEDIATE_FUNCTION(length_of_variable) \
  80. __ENUMERATE_SHELL_IMMEDIATE_FUNCTION(reexpand) \
  81. __ENUMERATE_SHELL_IMMEDIATE_FUNCTION(math)
  82. namespace Shell {
  83. class Shell;
  84. class Shell : public Core::Object {
  85. C_OBJECT(Shell);
  86. public:
  87. constexpr static auto local_init_file_path = "~/.shellrc";
  88. constexpr static auto global_init_file_path = "/etc/shellrc";
  89. constexpr static auto local_posix_init_file_path = "~/.posixshrc";
  90. constexpr static auto global_posix_init_file_path = "/etc/posixshrc";
  91. bool should_format_live() const { return m_should_format_live; }
  92. void set_live_formatting(bool value) { m_should_format_live = value; }
  93. void setup_signals();
  94. struct SourcePosition {
  95. DeprecatedString source_file;
  96. DeprecatedString literal_source_text;
  97. Optional<AST::Position> position;
  98. };
  99. struct RunnablePath {
  100. enum class Kind {
  101. Builtin,
  102. Function,
  103. Alias,
  104. Executable,
  105. };
  106. Kind kind;
  107. DeprecatedString path;
  108. bool operator<(RunnablePath const& other) const
  109. {
  110. return path < other.path;
  111. }
  112. bool operator==(RunnablePath const&) const = default;
  113. };
  114. struct RunnablePathComparator {
  115. int operator()(RunnablePath const& lhs, RunnablePath const& rhs)
  116. {
  117. if (lhs.path > rhs.path)
  118. return 1;
  119. if (lhs.path < rhs.path)
  120. return -1;
  121. return 0;
  122. }
  123. int operator()(StringView lhs, RunnablePath const& rhs)
  124. {
  125. if (lhs > rhs.path)
  126. return 1;
  127. if (lhs < rhs.path)
  128. return -1;
  129. return 0;
  130. }
  131. };
  132. int run_command(StringView, Optional<SourcePosition> = {});
  133. Optional<RunnablePath> runnable_path_for(StringView);
  134. Optional<DeprecatedString> help_path_for(Vector<RunnablePath> visited, RunnablePath const& runnable_path);
  135. ErrorOr<RefPtr<Job>> run_command(const AST::Command&);
  136. Vector<NonnullRefPtr<Job>> run_commands(Vector<AST::Command>&);
  137. bool run_file(DeprecatedString const&, bool explicitly_invoked = true);
  138. ErrorOr<bool> run_builtin(const AST::Command&, Vector<NonnullRefPtr<AST::Rewiring>> const&, int& retval);
  139. bool has_builtin(StringView) const;
  140. ErrorOr<RefPtr<AST::Node>> run_immediate_function(StringView name, AST::ImmediateExpression& invoking_node, Vector<NonnullRefPtr<AST::Node>> const&);
  141. static bool has_immediate_function(StringView);
  142. void block_on_job(RefPtr<Job>);
  143. void block_on_pipeline(RefPtr<AST::Pipeline>);
  144. DeprecatedString prompt() const;
  145. static DeprecatedString expand_tilde(StringView expression);
  146. static Vector<DeprecatedString> expand_globs(StringView path, StringView base);
  147. static Vector<DeprecatedString> expand_globs(Vector<StringView> path_segments, StringView base);
  148. ErrorOr<Vector<AST::Command>> expand_aliases(Vector<AST::Command>);
  149. DeprecatedString resolve_path(DeprecatedString) const;
  150. DeprecatedString resolve_alias(StringView) const;
  151. static bool has_history_event(StringView);
  152. ErrorOr<RefPtr<AST::Value const>> get_argument(size_t) const;
  153. ErrorOr<RefPtr<AST::Value const>> lookup_local_variable(StringView) const;
  154. ErrorOr<DeprecatedString> local_variable_or(StringView, DeprecatedString const&) const;
  155. void set_local_variable(DeprecatedString const&, RefPtr<AST::Value>, bool only_in_current_frame = false);
  156. void unset_local_variable(StringView, bool only_in_current_frame = false);
  157. void define_function(DeprecatedString name, Vector<DeprecatedString> argnames, RefPtr<AST::Node> body);
  158. bool has_function(StringView);
  159. bool invoke_function(const AST::Command&, int& retval);
  160. DeprecatedString format(StringView, ssize_t& cursor) const;
  161. RefPtr<Line::Editor> editor() const { return m_editor; }
  162. struct LocalFrame {
  163. LocalFrame(DeprecatedString name, HashMap<DeprecatedString, RefPtr<AST::Value>> variables)
  164. : name(move(name))
  165. , local_variables(move(variables))
  166. {
  167. }
  168. DeprecatedString name;
  169. HashMap<DeprecatedString, RefPtr<AST::Value>> local_variables;
  170. };
  171. struct Frame {
  172. Frame(Vector<NonnullOwnPtr<LocalFrame>>& frames, LocalFrame const& frame)
  173. : frames(frames)
  174. , frame(frame)
  175. {
  176. }
  177. ~Frame();
  178. void leak_frame() { should_destroy_frame = false; }
  179. private:
  180. Vector<NonnullOwnPtr<LocalFrame>>& frames;
  181. LocalFrame const& frame;
  182. bool should_destroy_frame { true };
  183. };
  184. [[nodiscard]] Frame push_frame(DeprecatedString name);
  185. void pop_frame();
  186. struct Promise {
  187. struct Data {
  188. struct Unveil {
  189. DeprecatedString path;
  190. DeprecatedString access;
  191. };
  192. DeprecatedString exec_promises;
  193. Vector<Unveil> unveils;
  194. } data;
  195. IntrusiveListNode<Promise> node;
  196. using List = IntrusiveList<&Promise::node>;
  197. };
  198. struct ScopedPromise {
  199. ScopedPromise(Promise::List& promises, Promise&& promise)
  200. : promises(promises)
  201. , promise(move(promise))
  202. {
  203. promises.append(this->promise);
  204. }
  205. ~ScopedPromise()
  206. {
  207. promises.remove(promise);
  208. }
  209. Promise::List& promises;
  210. Promise promise;
  211. };
  212. [[nodiscard]] ScopedPromise promise(Promise::Data data)
  213. {
  214. return { m_active_promises, { move(data), {} } };
  215. }
  216. enum class EscapeMode {
  217. Bareword,
  218. SingleQuotedString,
  219. DoubleQuotedString,
  220. };
  221. static DeprecatedString escape_token_for_double_quotes(StringView token);
  222. static DeprecatedString escape_token_for_single_quotes(StringView token);
  223. static DeprecatedString escape_token(StringView token, EscapeMode = EscapeMode::Bareword);
  224. static DeprecatedString escape_token(Utf32View token, EscapeMode = EscapeMode::Bareword);
  225. static DeprecatedString unescape_token(StringView token);
  226. enum class SpecialCharacterEscapeMode {
  227. Untouched,
  228. Escaped,
  229. QuotedAsEscape,
  230. QuotedAsHex,
  231. };
  232. static SpecialCharacterEscapeMode special_character_escape_mode(u32 c, EscapeMode);
  233. static bool is_glob(StringView);
  234. static Vector<StringView> split_path(StringView);
  235. enum class ExecutableOnly {
  236. Yes,
  237. No
  238. };
  239. ErrorOr<void> highlight(Line::Editor&) const;
  240. Vector<Line::CompletionSuggestion> complete();
  241. Vector<Line::CompletionSuggestion> complete(StringView);
  242. Vector<Line::CompletionSuggestion> complete_program_name(StringView, size_t offset, EscapeMode = EscapeMode::Bareword);
  243. Vector<Line::CompletionSuggestion> complete_variable(StringView, size_t offset);
  244. Vector<Line::CompletionSuggestion> complete_user(StringView, size_t offset);
  245. Vector<Line::CompletionSuggestion> complete_immediate_function_name(StringView, size_t offset);
  246. Vector<Line::CompletionSuggestion> complete_path(StringView base, StringView, size_t offset, ExecutableOnly executable_only, AST::Node const* command_node, AST::Node const*, EscapeMode = EscapeMode::Bareword);
  247. Vector<Line::CompletionSuggestion> complete_option(StringView, StringView, size_t offset, AST::Node const* command_node, AST::Node const*);
  248. ErrorOr<Vector<Line::CompletionSuggestion>> complete_via_program_itself(size_t offset, AST::Node const* command_node, AST::Node const*, EscapeMode escape_mode, StringView known_program_name);
  249. void restore_ios();
  250. u64 find_last_job_id() const;
  251. Job* find_job(u64 id, bool is_pid = false);
  252. Job* current_job() const { return m_current_job; }
  253. void kill_job(Job const*, int sig);
  254. DeprecatedString get_history_path();
  255. void print_path(StringView path);
  256. void cache_path();
  257. bool read_single_line();
  258. void notify_child_event();
  259. struct termios termios;
  260. struct termios default_termios;
  261. bool was_interrupted { false };
  262. bool was_resized { false };
  263. DeprecatedString cwd;
  264. DeprecatedString username;
  265. DeprecatedString home;
  266. constexpr static auto TTYNameSize = 32;
  267. constexpr static auto HostNameSize = 64;
  268. char ttyname[TTYNameSize];
  269. char hostname[HostNameSize];
  270. uid_t uid;
  271. Optional<int> last_return_code;
  272. Vector<DeprecatedString> directory_stack;
  273. CircularQueue<DeprecatedString, 8> cd_history; // FIXME: have a configurable cd history length
  274. HashMap<u64, NonnullRefPtr<Job>> jobs;
  275. Vector<RunnablePath, 256> cached_path;
  276. DeprecatedString current_script;
  277. enum ShellEventType {
  278. ReadLine,
  279. };
  280. enum class ShellError {
  281. None,
  282. InternalControlFlowBreak,
  283. InternalControlFlowContinue,
  284. InternalControlFlowInterrupted,
  285. InternalControlFlowKilled,
  286. EvaluatedSyntaxError,
  287. NonExhaustiveMatchRules,
  288. InvalidGlobError,
  289. InvalidSliceContentsError,
  290. OpenFailure,
  291. OutOfMemory,
  292. LaunchError,
  293. PipeFailure,
  294. WriteFailure,
  295. };
  296. void raise_error(ShellError kind, DeprecatedString description, Optional<AST::Position> position = {})
  297. {
  298. m_error = kind;
  299. m_error_description = move(description);
  300. if (m_source_position.has_value() && position.has_value())
  301. m_source_position.value().position = position.release_value();
  302. }
  303. bool has_error(ShellError err) const { return m_error == err; }
  304. bool has_any_error() const { return !has_error(ShellError::None); }
  305. DeprecatedString const& error_description() const { return m_error_description; }
  306. ShellError take_error()
  307. {
  308. auto err = m_error;
  309. m_error = ShellError::None;
  310. m_error_description = {};
  311. return err;
  312. }
  313. void possibly_print_error() const;
  314. static bool is_control_flow(ShellError error)
  315. {
  316. switch (error) {
  317. case ShellError::InternalControlFlowBreak:
  318. case ShellError::InternalControlFlowContinue:
  319. case ShellError::InternalControlFlowInterrupted:
  320. case ShellError::InternalControlFlowKilled:
  321. return true;
  322. default:
  323. return false;
  324. }
  325. }
  326. #define __ENUMERATE_SHELL_OPTION(name, default_, description) \
  327. bool name { default_ };
  328. struct Options {
  329. ENUMERATE_SHELL_OPTIONS();
  330. } options;
  331. #undef __ENUMERATE_SHELL_OPTION
  332. private:
  333. Shell(Line::Editor&, bool attempt_interactive, bool posix_mode = false);
  334. Shell();
  335. virtual ~Shell() override;
  336. RefPtr<AST::Node> parse(StringView, bool interactive = false, bool as_command = true) const;
  337. void timer_event(Core::TimerEvent&) override;
  338. bool is_allowed_to_modify_termios(const AST::Command&) const;
  339. void bring_cursor_to_beginning_of_a_line() const;
  340. Optional<int> resolve_job_spec(StringView);
  341. void add_entry_to_cache(RunnablePath const&);
  342. void remove_entry_from_cache(StringView);
  343. void stop_all_jobs();
  344. Job* m_current_job { nullptr };
  345. LocalFrame* find_frame_containing_local_variable(StringView name);
  346. LocalFrame const* find_frame_containing_local_variable(StringView name) const
  347. {
  348. return const_cast<Shell*>(this)->find_frame_containing_local_variable(name);
  349. }
  350. void run_tail(RefPtr<Job>);
  351. void run_tail(const AST::Command&, const AST::NodeWithAction&, int head_exit_code);
  352. [[noreturn]] void execute_process(Vector<char const*>&& argv);
  353. ErrorOr<void> execute_process(Span<StringView> argv);
  354. virtual void custom_event(Core::CustomEvent&) override;
  355. #define __ENUMERATE_SHELL_IMMEDIATE_FUNCTION(name) \
  356. ErrorOr<RefPtr<AST::Node>> immediate_##name(AST::ImmediateExpression& invoking_node, Vector<NonnullRefPtr<AST::Node>> const&);
  357. ENUMERATE_SHELL_IMMEDIATE_FUNCTIONS();
  358. #undef __ENUMERATE_SHELL_IMMEDIATE_FUNCTION
  359. ErrorOr<RefPtr<AST::Node>> immediate_length_impl(AST::ImmediateExpression& invoking_node, Vector<NonnullRefPtr<AST::Node>> const&, bool across);
  360. #define __ENUMERATE_SHELL_BUILTIN(builtin) \
  361. ErrorOr<int> builtin_##builtin(Main::Arguments);
  362. ENUMERATE_SHELL_BUILTINS();
  363. #undef __ENUMERATE_SHELL_BUILTIN
  364. static constexpr Array builtin_names = {
  365. #define __ENUMERATE_SHELL_BUILTIN(builtin) #builtin##sv,
  366. ENUMERATE_SHELL_BUILTINS()
  367. #undef __ENUMERATE_SHELL_BUILTIN
  368. ":"sv, // POSIX-y name for "noop".
  369. };
  370. bool m_should_ignore_jobs_on_next_exit { false };
  371. pid_t m_pid { 0 };
  372. struct ShellFunction {
  373. DeprecatedString name;
  374. Vector<DeprecatedString> arguments;
  375. RefPtr<AST::Node> body;
  376. };
  377. HashMap<DeprecatedString, ShellFunction> m_functions;
  378. Vector<NonnullOwnPtr<LocalFrame>> m_local_frames;
  379. Promise::List m_active_promises;
  380. Vector<NonnullRefPtr<AST::Redirection>> m_global_redirections;
  381. HashMap<DeprecatedString, DeprecatedString> m_aliases;
  382. bool m_is_interactive { true };
  383. bool m_is_subshell { false };
  384. bool m_should_reinstall_signal_handlers { true };
  385. bool m_in_posix_mode { false };
  386. ShellError m_error { ShellError::None };
  387. DeprecatedString m_error_description;
  388. Optional<SourcePosition> m_source_position;
  389. bool m_should_format_live { false };
  390. RefPtr<Line::Editor> m_editor;
  391. bool m_default_constructed { false };
  392. mutable bool m_last_continuation_state { false }; // false == not needed.
  393. Optional<size_t> m_history_autosave_time;
  394. StackInfo m_completion_stack_info;
  395. };
  396. [[maybe_unused]] static constexpr bool is_word_character(char c)
  397. {
  398. return c == '_' || (c <= 'Z' && c >= 'A') || (c <= 'z' && c >= 'a') || (c <= '9' && c >= '0');
  399. }
  400. inline size_t find_offset_into_node(StringView unescaped_text, size_t escaped_offset, Shell::EscapeMode escape_mode)
  401. {
  402. size_t unescaped_offset = 0;
  403. size_t offset = 0;
  404. auto do_find_offset = [&](auto& unescaped_text) {
  405. for (auto c : unescaped_text) {
  406. if (offset == escaped_offset)
  407. return unescaped_offset;
  408. switch (Shell::special_character_escape_mode(c, escape_mode)) {
  409. case Shell::SpecialCharacterEscapeMode::Untouched:
  410. break;
  411. case Shell::SpecialCharacterEscapeMode::Escaped:
  412. ++offset; // X -> \X
  413. break;
  414. case Shell::SpecialCharacterEscapeMode::QuotedAsEscape:
  415. switch (escape_mode) {
  416. case Shell::EscapeMode::Bareword:
  417. offset += 3; // X -> "\Y"
  418. break;
  419. case Shell::EscapeMode::SingleQuotedString:
  420. offset += 5; // X -> '"\Y"'
  421. break;
  422. case Shell::EscapeMode::DoubleQuotedString:
  423. offset += 1; // X -> \Y
  424. break;
  425. }
  426. break;
  427. case Shell::SpecialCharacterEscapeMode::QuotedAsHex:
  428. switch (escape_mode) {
  429. case Shell::EscapeMode::Bareword:
  430. offset += 2; // X -> "\..."
  431. break;
  432. case Shell::EscapeMode::SingleQuotedString:
  433. offset += 4; // X -> '"\..."'
  434. break;
  435. case Shell::EscapeMode::DoubleQuotedString:
  436. // X -> \...
  437. break;
  438. }
  439. if (c > NumericLimits<u8>::max())
  440. offset += 8; // X -> "\uhhhhhhhh"
  441. else
  442. offset += 3; // X -> "\xhh"
  443. break;
  444. }
  445. ++offset;
  446. ++unescaped_offset;
  447. }
  448. return unescaped_offset;
  449. };
  450. Utf8View view { unescaped_text };
  451. if (view.validate())
  452. return do_find_offset(view);
  453. return do_find_offset(unescaped_text);
  454. }
  455. }
  456. namespace AK {
  457. template<>
  458. struct Traits<Shell::Shell::RunnablePath> : public GenericTraits<Shell::Shell::RunnablePath> {
  459. static constexpr bool is_trivial() { return false; }
  460. static bool equals(Shell::Shell::RunnablePath const& self, Shell::Shell::RunnablePath const& other)
  461. {
  462. return self == other;
  463. }
  464. static bool equals(Shell::Shell::RunnablePath const& self, StringView other)
  465. {
  466. return self.path == other;
  467. }
  468. static bool equals(Shell::Shell::RunnablePath const& self, DeprecatedString const& other)
  469. {
  470. return self.path == other;
  471. }
  472. };
  473. }