@@ -1544,11 +1544,13 @@ func TestAgent_ReconnectingPTY(t *testing.T) {
1544
1544
_ , err := exec .LookPath ("screen" )
1545
1545
hasScreen := err == nil
1546
1546
1547
+ // Make sure UTF-8 works even with LANG set to something like C.
1548
+ t .Setenv ("LANG" , "C" )
1549
+
1547
1550
for _ , backendType := range backends {
1548
1551
backendType := backendType
1549
1552
t .Run (backendType , func (t * testing.T ) {
1550
1553
if backendType == "Screen" {
1551
- t .Parallel ()
1552
1554
if runtime .GOOS != "linux" {
1553
1555
t .Skipf ("`screen` is not supported on %s" , runtime .GOOS )
1554
1556
} else if ! hasScreen {
@@ -1563,8 +1565,6 @@ func TestAgent_ReconnectingPTY(t *testing.T) {
1563
1565
err = os .Symlink (bashPath , filepath .Join (dir , "bash" ))
1564
1566
require .NoError (t , err , "symlink bash into reconnecting pty PATH" )
1565
1567
t .Setenv ("PATH" , dir )
1566
- } else {
1567
- t .Parallel ()
1568
1568
}
1569
1569
1570
1570
ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitLong )
@@ -1656,6 +1656,17 @@ func TestAgent_ReconnectingPTY(t *testing.T) {
1656
1656
tr4 := testutil .NewTerminalReader (t , netConn4 )
1657
1657
require .NoError (t , tr4 .ReadUntil (ctx , matchEchoOutput ), "find echo output" )
1658
1658
require .ErrorIs (t , tr4 .ReadUntil (ctx , nil ), io .EOF )
1659
+
1660
+ // Ensure that UTF-8 is supported. Avoid the terminal emulator because it
1661
+ // does not appear to support UTF-8, just make sure the bytes that come
1662
+ // back have the character in it.
1663
+ netConn5 , err := conn .ReconnectingPTY (ctx , uuid .New (), 80 , 80 , "echo ❯" )
1664
+ require .NoError (t , err )
1665
+ defer netConn5 .Close ()
1666
+
1667
+ bytes , err := io .ReadAll (netConn5 )
1668
+ require .NoError (t , err )
1669
+ require .Contains (t , string (bytes ), "❯" )
1659
1670
})
1660
1671
}
1661
1672
}
0 commit comments