summaryrefslogtreecommitdiff
path: root/src/commands.cc
diff options
context:
space:
mode:
authorJohannes Altmanninger <aclopte@gmail.com>2024-11-24 10:19:32 +0100
committerMaxime Coste <mawww@kakoune.org>2024-12-09 22:23:35 +1100
commit7105584538f84d1c244809601fd3e573e8d6080c (patch)
treeca1e38b5fb7fd6862fb917212af817e3328f1412 /src/commands.cc
parent816a8c35a8cfa0cc8b7f9d80dd3c0e721ba3c273 (diff)
Print elapsed time when blocked on opening file for writing
Extract the logic for "waiting for shell to finish" and reuse it for potentially blocking calls to open() that use the O_WRONLY flags.
Diffstat (limited to 'src/commands.cc')
-rw-r--r--src/commands.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/commands.cc b/src/commands.cc
index 90f7a23e..0f892004 100644
--- a/src/commands.cc
+++ b/src/commands.cc
@@ -618,7 +618,7 @@ void do_write_buffer(Context& context, Optional<String> filename, WriteFlags fla
auto method = write_method.value_or_compute([&] { return context.options()["writemethod"].get<WriteMethod>(); });
context.hooks().run_hook(Hook::BufWritePre, effective_filename, context);
- write_buffer_to_file(buffer, effective_filename, method, flags);
+ write_buffer_to_file(context, buffer, effective_filename, method, flags);
context.hooks().run_hook(Hook::BufWritePost, effective_filename, context);
}
@@ -673,7 +673,7 @@ void write_all_buffers(const Context& context, bool sync = false, Optional<Write
auto method = write_method.value_or_compute([&] { return context.options()["writemethod"].get<WriteMethod>(); });
auto flags = sync ? WriteFlags::Sync : WriteFlags::None;
buffer->run_hook_in_own_context(Hook::BufWritePre, buffer->name(), context.name());
- write_buffer_to_file(*buffer, buffer->name(), method, flags);
+ write_buffer_to_file(context, *buffer, buffer->name(), method, flags);
buffer->run_hook_in_own_context(Hook::BufWritePost, buffer->name(), context.name());
}
}
@@ -1555,7 +1555,7 @@ const CommandDesc echo_cmd = {
message.push_back('\n');
if (auto filename = parser.get_switch("to-file"))
- write_to_file(*filename, message);
+ write_to_file(context, *filename, message);
else if (auto command = parser.get_switch("to-shell-script"))
ShellManager::instance().eval(*command, context, message, ShellManager::Flags::None, shell_context);
else if (parser.get_switch("debug"))