diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2019-11-01 15:53:40 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2019-11-01 17:58:27 +0300 |
commit | b1f343f5d20ea0c52a7265d134094035da13b806 (patch) | |
tree | 56529e03437e93791efa0473be89d29a23d08d2b /bpkg/utility.cxx | |
parent | af498a19d6c9c42748521225b7daae671a5f58b5 (diff) |
Add --package-cwd option to bpkg-pkg-test
Diffstat (limited to 'bpkg/utility.cxx')
-rw-r--r-- | bpkg/utility.cxx | 20 |
1 files changed, 20 insertions, 0 deletions
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 () { |