I’m trying to combine a powershell Get-Content -Wait command with a simple python script like so:
Get-Content -Wait log_file.log | python app_that_reads_stdin.py
the trouble is, in my python script, sys.stdin never iterates. This behavior is not seen without the -Wait
argument to Get-Content
the relevant python code is:
for line_number, message in enumerate(sys.stdin):
# stuff
I expected each line written to the file after the Get-Content command was executed to be sent to stdout, where it could be read from stdin in python.
this all works fine with tail -f
on *nux, and without the -Wait
flag in powershell, so I’m fairly convinced this is a peculiarity of this powershell comandlet.
What am I doing wrong? Is there another way I can approximate tail -f
on Windows?
user1169677 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.