Open 18853477039 opened 3 years ago
I fix it by reading data from stdin, but it's a bad way because the logic is too bad. Is there a good way?
\r
instructs the terminal to do a carriage return. The only way to get it printed in the input is to escape the \
before printing it. I.e. before feeding data to the stream you could do data.replace("\r", "\\r").
this is my debug code
` buf = os.read(self.input.fileno(), 4096)
LOG.info(repr(buf)) ` # when I send whoami by xshell's command bar the buf's log is [process_stdin():76] [PID:33553 TID:140554967484224] 'whoami\r'
Screen.buffer's log is '[root@fortress-test-169fb0752 ~]#' .
# If I just use the shell, input whoami the buf's log is _[process_stdin():76] [PID:66022 TID:139634374461248] 'w' [process_stdin():76] [PID:66022 TID:139634374461248] 'h' [process_stdin():76] [PID:66022 TID:139634374461248] 'o' [process_stdin():76] [PID:66022 TID:139634374461248] 'a' [process_stdin():76] [PID:66022 TID:139634374461248] 'm' [process_stdin():76] [PID:66022 TID:139634374461248] 'i' [processstdin():76] [PID:66022 TID:139634374461248] '\r'
Screen.buffer's log is '[root@fortress-test-169fb0752 ~]# whoami' # So, how can I get the input contains '\r'?