Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The tail -f command doesn't show the file's contents realtime #5168

Closed
ywsswy opened this issue May 3, 2020 · 4 comments
Closed

The tail -f command doesn't show the file's contents realtime #5168

ywsswy opened this issue May 3, 2020 · 4 comments

Comments

@ywsswy
Copy link

ywsswy commented May 3, 2020

  • Windows build number:
    C:\Users\23889>ver

Microsoft Windows [版本 10.0.18362.778]

C:\Users\23889>wsl --list
Ubuntu-20.04 (default)

  • What you're doing and what's happening:
    image

There is python script which print every second.

#!/usr/bin/env python3

import time
while True:
    print('hello, {}'.format(time.time()), flush=True)
    time.sleep(1)

i run it and redirect the output to file log.log, then use tail -f log.log to see what's happening.

python3 -u output.py >>log.log
tail -f log.log
  • What's wrong / what should be happening instead:
    The tail -f command doesn't show the file's contents realtime.
@onomatopellan
Copy link

onomatopellan commented May 4, 2020

First of all if you want to use Ubuntu 20.04 in WSL1 you need to do this workaraound.
#5125 (comment)

After that try calling your script from a /home folder and not a /mnt/* one.

@ywsswy
Copy link
Author

ywsswy commented May 4, 2020

SUCC!

tail -f valid except /mnt/* folder

@therealkenc
Copy link
Collaborator

therealkenc commented May 19, 2020

I was able to repro this on 19628 WSL1 on /mnt/c. It's a solid repro (thanks). In the screencap below tail -f does not update as the shell redirect writes (ie, a motion gif would be no better).

image

My mount line, because it can matter:

image

Now the damndest thing is a similar bash loop does cause tail -f to work as expected.

while true; do echo $(date) >> log.log; sleep 1; done

Which is all very odd, because the file notifications ought work alright with drvfs. It would take a pretty deep dive to glean what is going on there. What is writing to stdout shouldn't make a whit of difference.

Copy link
Contributor

This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants