summaryrefslogtreecommitdiff
path: root/src/shell_manager.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/shell_manager.hh')
-rw-r--r--src/shell_manager.hh12
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,