Skip to content

Commit

Permalink
Merge pull request #430 from antonvw/429-process-stdin
Browse files Browse the repository at this point in the history
close stdin to temporary fix the svn log issue
  • Loading branch information
antonvw authored Sep 3, 2023
2 parents 2aeafc8 + 346e357 commit d876fe4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/factory/process-imp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ void wex::factory::process_imp::boost_async_system(
{
m_is_running.store(false);

if (error.value() != 0 && p->m_eh_out != nullptr)
{
WEX_POST(ID_SHELL_APPEND_ERROR, error.message(), p->m_eh_out)
}

log::debug("async_system") << "exit" << data.exe();

if (m_debug.load())
Expand Down
7 changes: 7 additions & 0 deletions src/factory/process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ int wex::factory::process::system(const process_data& data)
m_stderr = ef.get();
}

if (data.std_in().empty())
{
boost::process::std_in
.close(); // e.g. for svn a password is required, not yet ok
log::trace("closing stdin");
}

if (!ec)
{
log::debug("system") << data.log();
Expand Down
3 changes: 2 additions & 1 deletion test/factory/test-process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,15 @@ TEST_CASE("wex::factory::process")
process.stop();
process.async_sleep_for(std::chrono::milliseconds(10));
REQUIRE(!process.write("xx"));
process.set_handler_dbg(&out); // if directly after out: crash
}

SUBCASE("invalid")
{
REQUIRE(process.async_system(wex::process_data("xxxx")));
process.set_handler_out(nullptr);
process.stop();
REQUIRE(!process.is_running());
process.set_handler_dbg(&out); // if directly after out: crash
}
}
#endif
Expand Down

0 comments on commit d876fe4

Please sign in to comment.