Skip to content

Commit

Permalink
修复linux下不可用的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
CppCXY committed Jan 21, 2022
1 parent c47befd commit 0e8c36f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CodeFormatServer/src/Session/IOSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ int IOSession::Run(asio::io_context& ioc)
while(true)
{
ioc.run();
ioc.reset();
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
});
Expand Down
3 changes: 2 additions & 1 deletion CodeFormatServer/src/Session/StandardIOSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#ifndef _WIN32
#include <unistd.h>
#endif
#include <thread>

#include "CodeFormatServer/Protocol/ProtocolParser.h"
#include "CodeFormatServer/Protocol/ProtocolBuffer.h"

Expand Down Expand Up @@ -56,7 +58,6 @@ bool StandardIO::HasError()
void StandardIO::Write(std::string_view content)
{
asio::write(*_out, asio::buffer(content.data(), content.size()));
std::cout.flush();
}

#else
Expand Down

0 comments on commit 0e8c36f

Please sign in to comment.