diff options
| author | Enrico Borba <enricozb@users.noreply.github.com> | 2024-12-23 09:23:58 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-23 09:23:58 +0100 |
| commit | 52125e6336d596aebdd4da91080b3178ddca7449 (patch) | |
| tree | 27d3e5c01660d567f22fee621c97753f294256b0 /src/shell_manager.hh | |
| parent | 14cb35f62b36b2f1aa530adb5e31c05ff1347bfc (diff) | |
| parent | 9c458c50661446fc6e7295787b06422137af099d (diff) | |
Merge branch 'master' into enricozb/daemon-stdin
Diffstat (limited to 'src/shell_manager.hh')
| -rw-r--r-- | src/shell_manager.hh | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/shell_manager.hh b/src/shell_manager.hh index f6ef38a4..5b42d644 100644 --- a/src/shell_manager.hh +++ b/src/shell_manager.hh @@ -58,10 +58,20 @@ public: friend constexpr bool with_bit_ops(Meta::Type<Flags>) { return true; } std::pair<String, int> eval(StringView cmdline, const Context& context, - StringView input = {}, + FunctionRef<StringView ()> stdin_generator, Flags flags = Flags::WaitForStdout, const ShellContext& shell_context = {}); + std::pair<String, int> eval(StringView cmdline, const Context& context, + StringView in, + Flags flags = Flags::WaitForStdout, + const ShellContext& shell_context = {}) + { + return eval(cmdline, context, + [in]() mutable { return std::exchange(in, StringView{}); }, + flags, shell_context); + } + Shell spawn(StringView cmdline, const Context& context, bool open_stdin, |
