Skip to content

Commit b9c79f8

Browse files
authored
Add encoding to ChannelFileWrite (#430)
* Add encoding to channel write files
1 parent a087a23 commit b9c79f8

3 files changed

Lines changed: 4 additions & 0 deletions

File tree

‎news/430.feature.rst‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Added an ``encoding`` attribute to ``ChannelFileWrite``.

‎src/execnet/gateway_base.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,6 +1079,8 @@ def __repr__(self) -> str:
10791079

10801080

10811081
class ChannelFileWrite(ChannelFile):
1082+
encoding = "utf-8"
1083+
10821084
def write(self, out: bytes) -> None:
10831085
self.channel.send(out)
10841086

‎testing/test_channel.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ def test_channel_file_write_error(self, gw: Gateway) -> None:
327327
channel = gw.remote_exec("pass")
328328
f = channel.makefile()
329329
assert not f.isatty()
330+
assert f.encoding == "utf-8"
330331
channel.waitclose(TESTTIMEOUT)
331332
with pytest.raises(IOError):
332333
f.write(b"hello")

0 commit comments

Comments
 (0)