conmon: Modify console terminal settings to match kube settings
We enable ONLCR on the console to match kube's terminal settings. Signed-off-by: Mrunal Patel <mpatel@redhat.com>
This commit is contained in:
parent
2a6db15113
commit
bfd1b83f51
2 changed files with 12 additions and 1 deletions
|
@ -17,6 +17,7 @@
|
|||
#include <sys/stat.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <termios.h>
|
||||
#include <syslog.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
@ -640,6 +641,7 @@ static gboolean terminal_accept_cb(int fd, G_GNUC_UNUSED GIOCondition condition,
|
|||
const char *csname = user_data;
|
||||
struct file_t console;
|
||||
int connfd = -1;
|
||||
struct termios tset;
|
||||
|
||||
ninfo("about to accept from csfd: %d", fd);
|
||||
connfd = accept4(fd, NULL, NULL, SOCK_CLOEXEC);
|
||||
|
@ -657,6 +659,15 @@ static gboolean terminal_accept_cb(int fd, G_GNUC_UNUSED GIOCondition condition,
|
|||
ninfo("console = {.name = '%s'; .fd = %d}", console.name, console.fd);
|
||||
free(console.name);
|
||||
|
||||
/* We change the terminal settings to match kube settings */
|
||||
if (tcgetattr(console.fd, &tset) == -1)
|
||||
pexit("Failed to get console terminal settings");
|
||||
|
||||
tset.c_oflag |= ONLCR;
|
||||
|
||||
if (tcsetattr(console.fd, TCSANOW, &tset) == -1)
|
||||
pexit("Failed to set console terminal settings");
|
||||
|
||||
/* We only have a single fd for both pipes, so we just treat it as
|
||||
* stdout. stderr is ignored. */
|
||||
masterfd_stdout = console.fd;
|
||||
|
|
|
@ -241,7 +241,7 @@ function teardown() {
|
|||
logpath="$DEFAULT_LOG_PATH/$pod_id/$ctr_id.log"
|
||||
[ -f "$logpath" ]
|
||||
echo "$logpath :: $(cat "$logpath")"
|
||||
grep -E "^[^\n]+ stdout here is some output$" "$logpath"
|
||||
grep -E "^[^\n]+ stdout here is some output" "$logpath"
|
||||
|
||||
run crioctl pod stop --id "$pod_id"
|
||||
echo "$output"
|
||||
|
|
Loading…
Reference in a new issue