Skip to content

Multiple empty lines printed to the terminal after stopping a job #9044

@sklirg

Description

@sklirg
  • Fish version:
fish --version
    echo $version
fish, version 3.5.0
3.5.0
  • OS: MacOS Monterey, 12.4
  • Terminal: Terminal.app (MacOS default terminal)

Hi! Thanks for fish. I really like it. 🐟

After upgrading to fish v3.5.0, after stopping foreground jobs (e.g. ctrl-z) such as vim or less, two empty lines are printed before the prompt shows.

Example:

sklirg@box:~
➤ less foo
fish: Job 1, 'less foo' has stopped


sklirg@box:~
➤

After digging a bit, it seems like 32ed0b8 (the fix for #8817) might be the culprit, at least running fish --debug='*' prints out two empty lines in the middle of the output after stopping the job (less foo + ctrl z):

...
proc-internal-proc: Created internal proc 7 to write output for proc 'string'
iothread: enqueuing work item (count is 1)
iothread: notifying thread: 0x100d3c580
exec-job-exec: Executed job 0 from command 'string repeat \n --count=(math (count (fish_prompt)) - 1) >&2'
proc-job-run: Run job 0 (string repeat \n --count=(math (count (fish_prompt)) - 1) >&2), UNCOMPLETED, INTERACTIVE
topic-monitor: TID 1 local  0,21,6 : current 0,21,6
topic-monitor: TID 1 becoming reader
iothread: pthread 0x16f753000 got work


proc-internal-proc: Internal proc 7 exited with status 0

I searched for the string repeat code and saw it was changed between v3.5.0 and v3.4.1, so I tried downgrading to v3.4.1 and it works as expected there.

Furthermore, executing the referenced (changed) function directly in the shell (with some dummy variables) produce different output between the versions:

sklirg@box:~
➤ fish
sklirg@box:~
➤ fish --version && echo $version
fish, version 3.5.0
3.5.0
sklirg@box:~
➤ fish_job_summary 1 1 3 4


sklirg@Magla:~
➤ /usr/local/bin/fish
sklirg@box:~
➤ /usr/local/bin/fish --version && echo $version
fish, version 3.4.1
3.4.1
sklirg@box:~
➤ fish_job_summary 1 1 3 4
sklirg@box:~
➤

Downgrading to v3.4.1 also solves the issue with two blank lines before the prompt:

sklirg@box:~
➤ /usr/local/bin/fish --version && echo $version
fish, version 3.4.1
3.4.1
sklirg@box:~
➤ less foo
fish: Job 1, 'less foo' has stopped
sklirg@box:~
➤

The same happens with the suggested empty config/$HOME:

sklirg@box:~
➤ sh -c 'env HOME=$(mktemp -d) fish'
sklirg@box:/U/sklirg
➤ touch foo
sklirg@box:/U/sklirg
➤ less foo
fish: Job 1, 'less foo' has stopped


sklirg@box:/U/sklirg
➤ fg
Send job 1 (less foo) to foreground
sklirg@box:/U/sklirg
➤ fish --version && echo $version 
fish, version 3.5.0
3.5.0
sklirg@box:/U/sklirg
➤ /usr/local/bin/fish
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
sklirg@box /U/sklirg> env | grep HOME
XDG_CONFIG_HOME=/var/folders/8t/sqnb2_j56q94_gcl33j0n_dh0000gp/T/tmp.JnygqqGq/.config
HOME=/var/folders/8t/sqnb2_j56q94_gcl33j0n_dh0000gp/T/tmp.JnygqqGq
sklirg@box /U/sklirg> less foo
fish: Job 1, 'less foo' has stopped
sklirg@box /U/sklirg> fg
Send job 1 (less foo) to foreground
sklirg@box /U/sklirg> /usr/local/bin/fish --version && echo $version
fish, version 3.4.1
3.4.1
sklirg@box /U/sklirg> 

If you need anything else from me, hit me up and I'll do my best to help :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething that's not working as intended

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions