boostorg / process

Boost Process
https://www.boost.org/libs/process
115 stars 114 forks source link

FIX: fix the incorrect parameter parsing #381

Closed zhixingchen0629 closed 2 months ago

zhixingchen0629 commented 2 months ago

if i pass this params vector to launch process when the executor was nullptr:

        std::string executor;
        std::vector<std::string> params;
        params.push_back("powershell");
        params.push_back("-noprofile");
        params.push_back("-executionpolicy");
        params.push_back("bypass");
        params.push_back("-file");
        params.push_back(m_command);
        auto launcher = boost::process::v2::default_process_launcher();
        m_child = std::move(launcher(m_ioContext, ec, executor.c_str(), params, boost::process::v2::process_stdio{nullptr, m_wPipe, m_wPipe}));

The actual splicing command_line at the bottom level is:

"" powershell -noprofile -executionpolicy bypass -file c:aaa

""It is superfluous, which cause create process error.

parameter splicing should take into account the situation where executor is empty

klemens-morgenstern commented 2 months ago

I am assuming that was fixed in develop already?

zhixingchen0629 commented 2 months ago

assuming

sorry, my pr was wrong commit, please check my latest pr https://github.com/boostorg/process/pull/382/