Skip to content

Commit d821650

Browse files
committed
Enforce clang-format in console_forwarder
1 parent e188073 commit d821650

2 files changed

Lines changed: 10 additions & 9 deletions

File tree

base/cvd/cuttlefish/host/commands/console_forwarder/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ cf_cc_binary(
1111
srcs = [
1212
"main.cpp",
1313
],
14-
clang_format_enabled = False,
1514
deps = [
1615
"//cuttlefish/common/libs/fs",
1716
"//cuttlefish/host/commands/kernel_log_monitor:kernel_log_monitor_utils",

base/cvd/cuttlefish/host/commands/console_forwarder/main.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,9 @@
4242
#include "cuttlefish/host/libs/config/logging.h"
4343
#include "cuttlefish/posix/strerror.h"
4444

45-
DEFINE_int32(console_in_fd,
46-
-1,
45+
DEFINE_int32(console_in_fd, -1,
4746
"File descriptor for the console's input channel");
48-
DEFINE_int32(console_out_fd,
49-
-1,
47+
DEFINE_int32(console_out_fd, -1,
5048
"File descriptor for the console's output channel");
5149

5250
namespace cuttlefish {
@@ -77,6 +75,7 @@ class ConsoleForwarder {
7775
// reading the console's output and input from the client.
7876
ReadLoop();
7977
}
78+
8079
private:
8180
SharedFD OpenPTY() {
8281
// Remove any stale symlink to a pts device
@@ -137,8 +136,9 @@ class ConsoleForwarder {
137136
bytes_written =
138137
fd->Write(buf_ptr->data() + bytes_written, bytes_to_write);
139138
if (bytes_written < 0) {
140-
// It is expected for writes to the PTY to fail if nothing is connected
141-
if(fd->GetErrno() != EAGAIN) {
139+
// It is expected for writes to the PTY to fail if nothing is
140+
// connected
141+
if (fd->GetErrno() != EAGAIN) {
142142
LOG(ERROR) << "Error writing to fd: " << fd->StrError();
143143
}
144144

@@ -176,7 +176,8 @@ class ConsoleForwarder {
176176

177177
Select(&read_set, nullptr, &error_set, nullptr);
178178
if (read_set.IsSet(console_out_)) {
179-
std::shared_ptr<std::vector<char>> buf_ptr = std::make_shared<std::vector<char>>(4096);
179+
std::shared_ptr<std::vector<char>> buf_ptr =
180+
std::make_shared<std::vector<char>>(4096);
180181
auto bytes_read = console_out_->Read(buf_ptr->data(), buf_ptr->size());
181182
// This is likely unrecoverable, so exit here
182183
CHECK(bytes_read > 0) << "Error reading from console output: "
@@ -189,7 +190,8 @@ class ConsoleForwarder {
189190
EnqueueWrite(buf_ptr, kernel_log_);
190191
}
191192
if (read_set.IsSet(client_fd) || error_set.IsSet(client_fd)) {
192-
std::shared_ptr<std::vector<char>> buf_ptr = std::make_shared<std::vector<char>>(4096);
193+
std::shared_ptr<std::vector<char>> buf_ptr =
194+
std::make_shared<std::vector<char>>(4096);
193195
auto bytes_read = client_fd->Read(buf_ptr->data(), buf_ptr->size());
194196
if (bytes_read <= 0) {
195197
// If this happens, it's usually because the PTY controller went away

0 commit comments

Comments
 (0)