nclib icon indicating copy to clipboard operation
nclib copied to clipboard

`interactive` acts different when stdin is pipe rather than from user

Open adamdoupe opened this issue 5 years ago • 1 comments

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:

adamdoupe avatar Apr 18 '19 17:04 adamdoupe

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().

rhelmot avatar Apr 22 '19 22:04 rhelmot