bat icon indicating copy to clipboard operation
bat copied to clipboard

tail <filename> | bat does not work on Windows 10

Open kaisark opened this issue 4 years ago • 6 comments
trafficstars

Windows 10 Version 1909 OS Build: 18363.1198

What version of bat are you using? bat 0.17.1

Describe the bug you encountered: tail | bat does not work on Windows 10.

Example: tail -f C:\app\oracle\diag\tnslsnr\DESKTOP-L5GI3V9\listener\trace\listener.log | bat --paging=never -l log

What did you expect to happen instead? tail should continue to function and tailed output should be piped to bat to show syntax highlighting.

How did you install bat? choco install bat

kaisark avatar Dec 02 '20 20:12 kaisark

~~Does it work if you do bat --paging=never?~~

I failed to read that properly. My bad.

That's odd. We don't do any buffering in bat, so it should be printing output lines as it gets new input lines.

Just to make sure it's not a quirk of tail on Windows, does it work properly if you pipe tail into cat?

eth-p avatar Dec 02 '20 21:12 eth-p

I tested in both PowerShell (administrator) and Command Prompt (administrator):

C:\WINDOWS\system32>tail -f C:\app\oracle\diag\tnslsnr\DESKTOP-L5GI3V9\listener\trace\listener.log | bat --paging=never -l log

PowerShell doesn't produce any output using the tail command with bat.

Command Prompt produces output using tail command with bat, but doesn't automatically print new output (a carriage return is required to advance output).


PS C:\WINDOWS\system32> choco install bat Chocolatey v0.10.15 [Pending] Removing incomplete install for 'vcredist140' Installing the following packages: bat By installing you accept licenses for the packages.

vcredist140 v14.28.29325.2 [Approved] vcredist140 package files install completed. Performing other installation steps. The package vcredist140 wants to run 'chocolateyInstall.ps1'. Note: If you don't run this script, the installation will fail. Note: To confirm automatically next time, use '-y' or consider: choco feature enable -n allowGlobalConfirmation Do you want to run the script?([Y]es/[A]ll - yes to all/[N]o/[P]rint): Y

Runtime for architecture x86 version 14.28.29325 is already installed. Runtime for architecture x64 version 14.28.29325 is already installed. The install of vcredist140 was successful. Software install location not explicitly set, could be in package or default install location if installer.

Bat v0.17.1 [Approved] bat package files install completed. Performing other installation steps. The package Bat wants to run 'chocolateyinstall.ps1'. Note: If you don't run this script, the installation will fail. Note: To confirm automatically next time, use '-y' or consider: choco feature enable -n allowGlobalConfirmation Do you want to run the script?([Y]es/[A]ll - yes to all/[N]o/[P]rint): Y

Downloading Bat from 'https://github.com/sharkdp/bat/releases/download/v0.17.1/bat-v0.17.1-x86_64-pc-windows-msvc.zip' Progress: 100% - Completed download of C:\Users<username>\AppData\Local\Temp\chocolatey\Bat\0.17.1\bat-v0.17.1-x86_64-pc-windows-msvc.zip (2.5 MB). Download of bat-v0.17.1-x86_64-pc-windows-msvc.zip (2.5 MB) completed. Hashes match. Extracting C:\Users<username>\AppData\Local\Temp\chocolatey\Bat\0.17.1\bat-v0.17.1-x86_64-pc-windows-msvc.zip to C:\ProgramData\chocolatey\lib\Bat\tools... C:\ProgramData\chocolatey\lib\Bat\tools ShimGen has successfully created a shim for bat.exe The install of bat was successful. Software installed to 'C:\ProgramData\chocolatey\lib\Bat\tools'

Chocolatey installed 2/2 packages. See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).


Log file attached: chocolatey-bat.log

kaisark avatar Dec 03 '20 03:12 kaisark

I'm not sure if I can help here, but for completeness, could you please post the output of

tail -f C:\app\oracle\diag\tnslsnr\DESKTOP-L5GI3V9\listener\trace\listener.log | bat --paging=never -l log --diagnostic

(note the --diagnostic option)

sharkdp avatar May 13 '21 09:05 sharkdp

I suppose I'm running into the same issue on Linux, but with a twist. tail can be successfully piped into bat, so can tail -f, but piping tail -f | grep into bat produces nothing.

Observed on ver. 0.21.0.

nekr0z avatar May 18 '22 19:05 nekr0z

I suppose I'm running into the same issue on Linux, but with a twist. tail can be successfully piped into bat, so can tail -f, but piping tail -f | grep into bat produces nothing.

Can you please tell us more? Ideally in the form of a new bug ticket.

sharkdp avatar May 22 '22 10:05 sharkdp

Can you please tell us more? Ideally in the form of a new bug ticket.

Sure. #2198

nekr0z avatar May 22 '22 11:05 nekr0z