From b1f343f5d20ea0c52a7265d134094035da13b806 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 1 Nov 2019 15:53:40 +0300 Subject: Add --package-cwd option to bpkg-pkg-test --- bpkg/utility.cxx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'bpkg/utility.cxx') diff --git a/bpkg/utility.cxx b/bpkg/utility.cxx index 3cb9fb5..3529d83 100644 --- a/bpkg/utility.cxx +++ b/bpkg/utility.cxx @@ -262,6 +262,26 @@ namespace bpkg } } + dir_path + change_wd (const dir_path& d) + { + try + { + dir_path r (dir_path::current_directory ()); + + if (verb >= 3) + text << "cd " << d; // Prints trailing slash. + + dir_path::current_directory (d); + return r; + } + catch (const system_error& e) + { + fail << "unable to change current directory to " << d << ": " << e + << endf; + } + } + fdpipe open_pipe () { -- cgit v1.1