Repository: apache/arrow
File: cpp/src/arrow/testing/process.cc (C++)

Code before:
        }
      }
    }
#  else
    process_group_ = nullptr;
#  endif
    process_ = nullptr;
#endif
  }

  Status SetExecutable(const std::string& name) {
#ifdef BOOST_PROCESS_AVAILABLE
#  ifdef BOOST_PROCESS_USE_V2
    executable_ = process::environment::find_executable(name);
#  else
    executable_ = process::search_path(name);
#  endif
    if (executable_.empty()) {
      // Search the current executable directory as fallback.
      ARROW_ASSIGN_OR_RAISE(auto current_exe, ResolveCurrentExecutable());
#  ifdef BOOST_PROCESS_USE_V2
      std::unordered_map<process::environment::key, process::environment::value> env;
      for (const auto& kv : process::environment::current()) {
        env[kv.key()] = process::environment::value(kv.value());
      }
      env["PATH"] = process::environment::value(current_exe.parent_path());
      executable_ = process::environment::find_executable(name, env);
#  else
      executable_ = process::search_path(name, {current_exe.parent_path()});
#  endif
    }
    if (executable_.empty()) {
      return Status::IOError("Failed to find '", name, "' in PATH");
    }
    return Status::OK();
#else
    return Status::NotImplemented("Boost.Process isn't available on this system");
#endif
  }

  void SetArgs(const std::vector<std::string>& args) {
#ifdef BOOST_PROCESS_AVAILABLE
    args_ = args;
#endif
  }

  void SetEnv(const std::string& name, const std::string& value) {
#ifdef BOOST_PROCESS_AVAILABLE
#  ifdef BOOST_PROCESS_USE_V2
    env_[name] = process::environment::value(value);
#  else

Review comment (suggestion):
Recent Boost or old g++ (12.2.1) don't accept `std::filesystem::path`:

```text
/arrow/cpp/src/arrow/testing/process.cc: In member function ‘arrow::Status arrow::util::Process::Impl::SetExecutable(const std::string&)’:
/arrow/cpp/src/arrow/testing/process.cc:179:74: error: call of overloaded ‘value(std::filesystem::__cxx11::path)’ is ambiguous
  179 |       env["PATH"] = process::environment::value(current_exe.parent_path());
      |                                                                          ^
In file included from /arrow/cpp/src/arrow/testing/process.cc:44:
/opt/vcpkg/installed/amd64-linux-static-release/include/boost/process/v2/environment.hpp:727:14: note: candidate: ‘boost::process::v2::environment::value::value(boost::process::v2::environment::value_view)’
  727 |     explicit value(value_view kv) : value_(kv.c_str()) {}
      |              ^~~~~
/opt/vcpkg/installed/amd64-linux-static-release/include/boost/process/v2/environment.hpp:723:5: note: candidate: ‘boost::process::v2::environment::value::value(string_type&&)’
  723 |     value( string_type&& source ) : value_(std::move(source)) {}
      |     ^~~~~
/opt/vcpkg/installed/amd64-linux-static-release/include/boost/process/v2/environment.hpp:722:5: note: candidate: ‘boost::process::v2::environment::value::value(const string_type&)’
  722 |     value( const string_type& source ) : value_(source) {}
      |     ^~~~~
```

We need to convert `std::filesystem::path` to `std::string` explicitly.

Code after:
        }
      }
    }
#  else
    process_group_ = nullptr;
#  endif
    process_ = nullptr;
#endif
  }

  Status SetExecutable(const std::string& name) {
#ifdef BOOST_PROCESS_AVAILABLE
#  ifdef BOOST_PROCESS_USE_V2
    executable_ = process::environment::find_executable(name);
#  else
    executable_ = process::search_path(name);
#  endif
    if (executable_.empty()) {
      // Search the current executable directory as fallback.
      ARROW_ASSIGN_OR_RAISE(auto current_exe, ResolveCurrentExecutable());
#  ifdef BOOST_PROCESS_USE_V2
      std::unordered_map<process::environment::key, process::environment::value> env;
      for (const auto& kv : process::environment::current()) {
        env[kv.key()] = process::environment::value(kv.value());
      }
      env["PATH"] = process::environment::value(current_exe.parent_path().string());
      executable_ = process::environment::find_executable(name, env);
#  else
      executable_ = process::search_path(name, {current_exe.parent_path()});
#  endif
    }
    if (executable_.empty()) {
      return Status::IOError("Failed to find '", name, "' in PATH");
    }
    return Status::OK();
#else
    return Status::NotImplemented("Boost.Process isn't available on this system");
#endif
  }

  void SetArgs(const std::vector<std::string>& args) {
#ifdef BOOST_PROCESS_AVAILABLE
    args_ = args;
#endif
  }

  void SetEnv(const std::string& name, const std::string& value) {
#ifdef BOOST_PROCESS_AVAILABLE
#  ifdef BOOST_PROCESS_USE_V2
    env_[name] = process::environment::value(value);
#  else