Keep terminal in a sane state when sudo use_pty is used.

This fixes #909 and is an alternative to the #922 pull request. When
sudo's use_pty is used with sshuttle, it causes issues with the
terminal. Pull request #712 contains some fixes for this problem.
However, when sshuttle is run with the --daemon option, it left the
user's terminal in a non-sane state. The problem appears to be related
to a socketpair that the firewall uses for communication. By setting
it up slightly differently (see changes to client.py and firewall.py),
the terminal state is no longer disrupted. This commit also changes
line endings of the printed messages from \r\n to \n. This undoes a
change introduced by pull request #712 and is no longer needed.
This commit is contained in:
Scott Kuhl
2024-01-04 15:49:43 -05:00
committed by Brian May
parent b4e4680ef4
commit a604d107ef
5 changed files with 16 additions and 27 deletions

View File

@ -24,19 +24,19 @@ def test_log(mock_stderr, mock_stdout):
call.flush(),
]
assert mock_stderr.mock_calls == [
call.write('prefix: message\r\n'),
call.write('prefix: message\n'),
call.flush(),
call.write('prefix: abc\r\n'),
call.write('prefix: abc\n'),
call.flush(),
call.write('prefix: message 1\r\n'),
call.write('prefix: message 1\n'),
call.flush(),
call.write('prefix: message 2\r\n'),
call.write(' line2\r\n'),
call.write(' line3\r\n'),
call.write('prefix: message 2\n'),
call.write(' line2\n'),
call.write(' line3\n'),
call.flush(),
call.write('prefix: message 3\r\n'),
call.write(' line2\r\n'),
call.write(' line3\r\n'),
call.write('prefix: message 3\n'),
call.write(' line2\n'),
call.write(' line3\n'),
call.flush(),
]
@ -51,7 +51,7 @@ def test_debug1(mock_stderr, mock_stdout):
call.flush(),
]
assert mock_stderr.mock_calls == [
call.write('prefix: message\r\n'),
call.write('prefix: message\n'),
call.flush(),
]
@ -76,7 +76,7 @@ def test_debug2(mock_stderr, mock_stdout):
call.flush(),
]
assert mock_stderr.mock_calls == [
call.write('prefix: message\r\n'),
call.write('prefix: message\n'),
call.flush(),
]
@ -101,7 +101,7 @@ def test_debug3(mock_stderr, mock_stdout):
call.flush(),
]
assert mock_stderr.mock_calls == [
call.write('prefix: message\r\n'),
call.write('prefix: message\n'),
call.flush(),
]