From d15847dbfe3ae41879776250ddcbdfdfde51a1fc Mon Sep 17 00:00:00 2001 From: phanes Date: Thu, 8 Feb 2024 07:23:01 -0500 Subject: [PATCH] working on issue with pty redirection, not easily reproducible --- sample/components/independent_test_1.bash | 2 +- src/lcpex/vpty/libclpex_tty.cpp | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/sample/components/independent_test_1.bash b/sample/components/independent_test_1.bash index 32dd3e9..e98115f 100755 --- a/sample/components/independent_test_1.bash +++ b/sample/components/independent_test_1.bash @@ -1,7 +1,7 @@ #!/usr/bin/bash # echo test from script -/usr/bin/dialog --title "This should be one argument" --inputbox "Enter your name:" 0 0 +#/usr/bin/dialog --title "This should be one argument" --inputbox "Enter your name:" 0 0 diff --git a/src/lcpex/vpty/libclpex_tty.cpp b/src/lcpex/vpty/libclpex_tty.cpp index 3401477..cacf7a6 100644 --- a/src/lcpex/vpty/libclpex_tty.cpp +++ b/src/lcpex/vpty/libclpex_tty.cpp @@ -235,6 +235,10 @@ int exec_pty( byte_count = read(watched_fds[this_fd].fd, buf, BUFFER_SIZE); if (byte_count == -1) { + if (errno == EAGAIN) { + // no data to read + continue; + } // error reading from pipe safe_perror("read", &ttyOrig ); exit(EXIT_FAILURE); @@ -265,8 +269,8 @@ int exec_pty( } if (watched_fds[this_fd].revents & POLLERR) { close(watched_fds[this_fd].fd); - //break_out = true; - continue; + break_out = true; + //continue; } // if (watched_fds[this_fd].revents & POLLHUP) { // // this pipe has hung up