From 26751a7e2e0c131f7e6c63885d74ed2ffc5c7b92 Mon Sep 17 00:00:00 2001 From: Timothy Stack Date: Thu, 22 Apr 2021 19:03:42 +0000 Subject: [PATCH] [tailer] add option to ssh to a host --- src/tailer/drive_tailer.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/tailer/drive_tailer.cc b/src/tailer/drive_tailer.cc index 655cdc64..340be9c4 100644 --- a/src/tailer/drive_tailer.cc +++ b/src/tailer/drive_tailer.cc @@ -38,8 +38,9 @@ int main(int argc, char *const *argv) { auto tmppath = ghc::filesystem::temp_directory_path() / "drive_tailer"; + auto host = getenv("TAILER_HOST"); - ghc::filesystem::remove_all(tmppath); + // ghc::filesystem::remove_all(tmppath); ghc::filesystem::create_directories(tmppath); auto_pipe in_pipe(STDIN_FILENO); @@ -62,7 +63,11 @@ int main(int argc, char *const *argv) auto exe_dir = this_exe.parent_path(); auto tailer_exe = exe_dir / "tailer"; - execvp(tailer_exe.c_str(), argv); + if (host != nullptr) { + execlp("ssh", "ssh", "-q", host, "./tailer", NULL); + } else { + execvp(tailer_exe.c_str(), argv); + } exit(EXIT_FAILURE); }