icn
icn

Reputation: 17876

python stdin eof

How to pass python eof to stdin

here is my code

p = Popen(commd,stdout=PIPE,stderr=PIPE,stdin=PIPE)
o = p.communicate(inputstring)[0]

when i run the commd in command line after i input the inputstring windows still expecting a Ctrl+Z to finish accepting input.

How can I pass eof or Ctrl+Z in program?

Thanks!

Upvotes: 3

Views: 5588

Answers (1)

fserb
fserb

Reputation: 4223

p.stdin.close()

after p.communicate, finishes the input and sends EOF to commd.

Upvotes: 9

Related Questions