nelhage / reptyr

Reparent a running program to a new terminal
MIT License
5.71k stars 216 forks source link

fix: expect EOL in test #141

Closed Et7f3 closed 2 years ago

Et7f3 commented 2 years ago

ECHO: world final Traceback (most recent call last): File "test/basic.py", line 27, in expect_eof(child.child_fd) File "/build/source/test/util.py", line 13, in expect_eof raise AssertionError("Expected EOF, got read: {}'".format(data)) AssertionError: Expected EOF, got read: '

When I run in python3 I get b"\r\n"

Also a test I did to confirm:

42sh$ printf "a\r\nb\nc" | ./victim | xxd
00000000: 4543 484f 3a20 610d 0a45 4348 4f3a 2062  ECHO: a..ECHO: b
00000010: 0a45 4348 4f3a 2063                      .ECHO: c
Et7f3 commented 2 years ago

Maybe this issue is I don't use the same expect than you. I didn't find requirement.txt so 🤷

nelhage commented 2 years ago

This seems to match the advice in https://pexpect.readthedocs.io/en/stable/overview.html#find-the-end-of-line-cr-lf-conventions and it passes in CI so if it fixes the build for you, seems good to me. Thanks for the PR!