[ 
https://issues.apache.org/jira/browse/CASSANDRA-16956?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17430738#comment-17430738
 ] 

Bowen Song commented on CASSANDRA-16956:
----------------------------------------

It seems like the command received from stdin is being written back to the 
stdout. 
{code:java}
-> with self.assertRaises(BaseException) as cm:
(Pdb) l
806             RemotePdb('127.0.0.1', 4444).set_trace()
807             for semicolon in ('', ';'):
808                 with testrun_cqlsh(tty=True, env=self.default_env) as c:
809                     cmd = 'exit%s\n' % semicolon
810                     c.send(cmd)
811  ->                 with self.assertRaises(BaseException) as cm:
812                         c.read_lines(1)
813                     self.assertIn(type(cm.exception), (EOFError, OSError))
814  
815         def test_help_types(self):
816             with testrun_cqlsh(tty=True, env=self.default_env) as c:
(Pdb) result=c.read_lines(1)
(Pdb) p result
['exit\r\n']
(Pdb) result=c.read_lines(1)
*** OSError: [Errno 5] Input/output error
{code}
I don't see any code doing this, and it took me a while to find out that the 
output comes from the PTY's echo. So turning the echo off with the code below 
will fix it:
{code:java}
def set_controlling_pty(master, slave):
    os.setsid()
    os.close(master)
    for i in range(3):
        os.dup2(slave, i)
    if slave > 2:
        os.close(slave)
    os.close(os.open(os.ttyname(1), os.O_RDWR))

    # turn off the PTY's ECHO
    attr = termios.tcgetattr(0)
    attr[3] = attr[3] & ~termios.ECHO
    termios.tcsetattr(0, termios.TCSANOW, attr)
{code}
However, I soon realised that as soon as I turn of the ECHO, many other test 
cases started to fail, because they are expecting the echo to be on. Why wound 
this test expecting it to be off? I'm puzzled. Anyway, to fix this issue, it's 
probably better not to turn of ECHO, but to correct this test's expectation. It 
should expect the ECHO is on and handle it correctly. Here you go - 
https://github.com/instaclustr/cassandra/pull/37

> Remove windows-specific classes
> -------------------------------
>
>                 Key: CASSANDRA-16956
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-16956
>             Project: Cassandra
>          Issue Type: Task
>          Components: Build
>            Reporter: Brandon Williams
>            Assignee: Stefan Miklosovic
>            Priority: Normal
>             Fix For: 4.0.x, 4.x
>
>
> To continue the work CASSANDRA-16171 began, now that Windows support is no 
> more there are some source files that can be removed.
> Just doing a naive grep on the source directory I see:
> {noformat}
> src/java/org/apache/cassandra/db/WindowsFailedSnapshotTracker.java
> src/java/org/apache/cassandra/utils/NativeLibraryWindows.java
> src/java/org/apache/cassandra/utils/WindowsTimer.java
> {noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to