nclib
nclib copied to clipboard
`interactive` acts different when stdin is pipe rather than from user
Test cases: https://gist.github.com/adamdoupe/fa53c586c2bab357e0a97a524a865240
repro:
run python server.py
then run:
python -c "print('hello\n')" | python test.py
expected output from test.py:
hello
received output from test.py:
What's happening is that this is equivalent to entering hello and then pressing ctrl-d before the server has a chance to reply.
Normal netcat doesn't take any action on ctrl-d - it only terminates when the socket dies. I'm not sure if this is behavior I want to replicate though..?
You perhaps want nc.recvall()
.