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

Control C exits with return 130 #2955

Closed
p1r473 opened this issue May 6, 2024 · 3 comments
Closed

Control C exits with return 130 #2955

p1r473 opened this issue May 6, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@p1r473
Copy link

p1r473 commented May 6, 2024

image

What steps will reproduce the bug?

open file in bat; control c to exit

What happens?
bat exits with return code 130
The Putty terminal makes an annoying bell noise which I had to disable due to this

What did you expect to happen instead?
return code is 0; control c should be a good exit
q right now exits with 0 which is good imho

How did you install bat?

apt install bat

wget -O /home/pi/bat_0.24.0_arm64.deb https://github.com/sharkdp/bat/releases/download/v0.24.0/bat_0.24.0_arm64.deb 
dpkg -i /home/pi/bat_0.24.0_arm64.deb

Diagnostics:


#### Software version

bat 0.24.0 (fc95468)

#### Operating system

Linux 6.6.28+rpt-rpi-2712

#### Command-line

bash
bat --diagnostic

#### Environment variables

bash
SHELL=/bin/zsh
PAGER=less
LESS=-R
LANG=en_GB.UTF-8
LC_ALL=<not set>
BAT_PAGER=<not set>
BAT_PAGING=<not set>
BAT_CACHE_PATH=<not set>
BAT_CONFIG_PATH=<not set>
BAT_OPTS=<not set>
BAT_STYLE=<not set>
BAT_TABS=<not set>
BAT_THEME=<not set>
XDG_CONFIG_HOME=<not set>
XDG_CACHE_HOME=<not set>
COLORTERM=<not set>
NO_COLOR=<not set>
MANPAGER=<not set>


#### System Config file


# Set the theme to "TwoDark"
--theme="DarkNeon"

# Show line numbers, Git modifications and file header (but no grid)
#--style="numbers,changes,header"
--style="changes"

# Use italic text on the terminal (not supported on all terminals)
--italic-text=always

# Use C++ syntax for Arduino .ino files
--map-syntax "*.ino:C++"


#### Config file

Could not read contents of '/root/.config/bat/config': No such file or directory (os error 2).

#### Custom assets metadata

Could not read contents of '/root/.cache/bat/metadata.yaml': No such file or directory (os error 2).

#### Custom assets

'/root/.cache/bat' not found

#### Compile time information

- Profile: release
- Target triple: aarch64-unknown-linux-gnu
- Family: unix
- OS: linux
- Architecture: aarch64
- Pointer width: 64
- Endian: little
- CPU features: neon
- Host: x86_64-unknown-linux-gnu

#### Less version

> less --version
less 590 (GNU regular expressions)
Copyright (C) 1984-2021  Mark Nudelman

less comes with NO WARRANTY, to the extent permitted by law.
For information about the terms of redistribution,
see the file named README in the less distribution.
Home page: https://greenwoodsoftware.com/less
@p1r473 p1r473 added the bug Something isn't working label May 6, 2024
@eth-p
Copy link
Collaborator

eth-p commented May 9, 2024

Outside of using the pager, bat would print everything to the terminal and exit immediately. That makes me suspect it might be a problem with less, the pager we use.

Does the same thing happen if you use less the-file.txt or cat the-file.txt | less?

If possible, can you try adding a more recent version of less to your path? The latest version should be 654.

@p1r473
Copy link
Author

p1r473 commented May 11, 2024

❯ /usr/local/bin/less --version
less 643 (POSIX regular expressions)

❯ /usr/local/bin/less /var/log/syslog                                                                                                               
❯ echo $?
0     

❯ /usr/bin/cat /var/log/syslog | /usr/local/bin/less 
❯ echo $?
0  


❯ bat /var/log/syslog 
❯ echo $?
0         

@eth-p
That looks good now I think! How can I get it to print to terminal and exit and not use the interface where I need to push Q to quit?
I tried export BAT_PAGER="less -R" but still need to press Q to quit
Also tried bat --pager="less -R" /var/log/syslog

@p1r473 p1r473 closed this as completed May 11, 2024
@eth-p
Copy link
Collaborator

eth-p commented May 11, 2024

The interface where you need to press Q to quit is less, and there's two ways you can disable it:

If you don't want it to show up when there's only a couple of lines to print, --pager="less -R --quit-if-one-screen".

If you don't want it to show up at all, --paging=never disables it entirely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants