mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-27 02:01:42 +00:00
SCRIPT: wpiformat
This commit is contained in:
committed by
Peter Johnson
parent
ae6bdc9d25
commit
2109161534
@@ -25,8 +25,8 @@ namespace uv = wpi::net::uv;
|
||||
static uint64_t startTime = wpi::util::Now();
|
||||
|
||||
static bool NewlineBuffer(std::string& rem, uv::Buffer& buf, size_t len,
|
||||
wpi::util::SmallVectorImpl<uv::Buffer>& bufs, bool tcp,
|
||||
uint16_t tcpSeq) {
|
||||
wpi::util::SmallVectorImpl<uv::Buffer>& bufs,
|
||||
bool tcp, uint16_t tcpSeq) {
|
||||
// scan for last newline
|
||||
std::string_view str(buf.base, len);
|
||||
size_t idx = str.rfind('\n');
|
||||
@@ -157,7 +157,8 @@ int main(int argc, char* argv[]) {
|
||||
port = portValue.value();
|
||||
}
|
||||
} else {
|
||||
wpi::util::print(stderr, "unrecognized command line option {}\n", argv[arg]);
|
||||
wpi::util::print(stderr, "unrecognized command line option {}\n",
|
||||
argv[arg]);
|
||||
err = true;
|
||||
}
|
||||
++arg;
|
||||
@@ -175,8 +176,9 @@ int main(int argc, char* argv[]) {
|
||||
}
|
||||
|
||||
auto loop = uv::Loop::Create();
|
||||
loop->error.connect(
|
||||
[](uv::Error err) { wpi::util::print(stderr, "uv ERROR: {}\n", err.str()); });
|
||||
loop->error.connect([](uv::Error err) {
|
||||
wpi::util::print(stderr, "uv ERROR: {}\n", err.str());
|
||||
});
|
||||
|
||||
// create ttys
|
||||
auto stdinTty = uv::Tty::Create(loop, 0, true);
|
||||
@@ -213,7 +215,8 @@ int main(int argc, char* argv[]) {
|
||||
}
|
||||
|
||||
// close on error
|
||||
tcp->error.connect([s = tcp.get()](wpi::net::uv::Error err) { s->Close(); });
|
||||
tcp->error.connect(
|
||||
[s = tcp.get()](wpi::net::uv::Error err) { s->Close(); });
|
||||
|
||||
// tee
|
||||
CopyTcp(*stdinTty, tcp);
|
||||
|
||||
Reference in New Issue
Block a user