Skip to content

Ctrl+z (suspend) does not work after zplug loaded #322

Closed

Description

@kota65535

Problem Summary

Ctrl+z (suspend) does not work after zplug loaded.

System Information

  • uname -a
Linux chajka 3.10.0-514.2.2.el7.x86_64 #1 SMP Tue Dec 6 23:06:41 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
  • zsh version
zsh 5.0.2 (x86_64-redhat-linux-gnu)
  • zplug version/commit
2.3.4

Minimal zshrc

source ~/.zplug/init.zsh
zplug load --verbose

If I comment out zplug load, Ctrl+Z becomes working well.

Steps to Reproduce

  1. Start zsh.
  2. Launch vim.
  3. Try to press Ctrl+Z to suspend vim, but it does not suspend. This also happen in emacs.

Activity

  1. paulhybryant commented on Dec 22, 2016

    @paulhybryant

    I ran into this a couple of times as well.

    However, if I exit and start a new shell, it will work again. I cannot seem to reproduce it consistently.

  2. kota65535 commented on Dec 22, 2016

    @kota65535
    Author

    Hmm, in my environment, it continues to happen even if I restarted zsh...

  3. paulhybryant commented on Dec 22, 2016

    @paulhybryant

    Yeah in that case that is more troublesome.

  4. babarot commented on Dec 22, 2016

    @babarot
    Member

    However, if I exit and start a new shell, it will work again.

    Perhaps you have set the monitor option

  5. paulhybryant commented on Dec 22, 2016

    @paulhybryant

    Can you elaborate why using the monitor option will cause C-z to stop working?
    From the zsh documentation of the monitor option I didn't find relevant information.

  6. babarot commented on Dec 22, 2016

    @babarot
    Member

    Because it is an option related to on/off of job control.

  7. paulhybryant commented on Dec 22, 2016

    @paulhybryant

    Then if c-z stop working, it should be that the monitor option is not set (in your comment above you seem to indicate it stops working because monitor is set)

    Thanks for the quick reply.

  8. kota65535 commented on Dec 22, 2016

    @kota65535
    Author

    Appending set -o monitor to my .zshrc makes it work fine, thank you.

  9. paulhybryant commented on Dec 22, 2016

    @paulhybryant

    I found that this is unset in base/core/load.zsh

    There is a todo to make it the default.

  10. bluekeyes commented on Dec 24, 2016

    @bluekeyes

    I suggest this be reopened and considered a bug, as it seems wrong to me that calling zplug load changes options outside of the loaded plugins. If intentional, it would be helpful to document this behavior; I'm in the process of switching to zplug and it took me quite a bit of time to track down why job control was disabled, since the ZSH docs say that monitor is on by default in interactive shells.

  11. paulhybryant commented on Dec 28, 2016

    @paulhybryant

    What is the downside / concern of turning monitor on by default?

  12. babarot commented on Dec 28, 2016

    @babarot
    Member

    @paulhybryant zplug performs many processing in the background process. Therefore, it is essential to turn off the monitor option.

  13. 11 remaining items

  14. casimir commented on Jan 9, 2017

    @casimir

    This is still happening with version 2.4.1. And I have to say this is still painful. Any insight?

  15. babarot commented on Jan 9, 2017

    @babarot
    Member

    Once all the background processes for zplug are done, the monitor option should be set automatically within 30 seconds.

    https://github.com/zplug/zplug/blob/master/base/job/polling.zsh

  16. casimir commented on Jan 9, 2017

    @casimir

    I can't reproduce it after a zplug clear, guess that was some old cache causing this. Sorry for the noise. And thanks for the quick response @b4b4r07.

  17. RobertAudi commented on Jan 23, 2017

    @RobertAudi

    @b4b4r07 I have had this issue for way way too long and could not solve it. But then I found a "loophole" which rendered virtually any potential fix useless:

    The polling code only checks if the lock file exists. That means that if this file is added manually then zplug will disable the monitor option automatically and indefinitely.

    Also the clear command doesn't remove the lock file. This means that it is not impossible that an old lock file that was not cleaned up (maybe due to a zplug job that might have been interrupted).

    I fixed the problem by manually removing the lock file. After that, everything worked normally out of the box (without the set -o monitor fix or anything similar).

    I haven't looked around but a first step to resolve this issue once and for all would be to check the validity of the lock file. Or check if there are any zplug jobs still running. And if the lock file contains a pid, check if that pid exist and points to a zplug job. But I'm pretty sure testing for the existence of the file is not enough.

  18. simonm commented on Aug 1, 2018

    @simonm

    Removing the lock file $_zplug_lock fixes the issue for subsequent restarts of zsh.

  19. darthbanana13 commented on Dec 11, 2018

    @darthbanana13

    I am still having this issue and setopt monitor after zplug load does not fix it. I can reproduce it consistently on all my machines.

    Here is my .zshrc

    I tried zplug clear, removing the lock file but still noting. I have to manually type in the terminal setopt monitor.

    Edit:
    Removing job.lock worked.

  20. drasill commented on Feb 1, 2019

    @drasill

    Removing the lock file did work for me.

  21. antekone commented on Apr 14, 2019

    @antekone

    Removing the lock file works. The filename is ~/.zplug/log/job.lock.

  22. masto commented on Jan 7, 2023

    @masto

    FWIW, I just ran into this issue on two different machines after using zplug for a couple of days. It seems like there is no stale lock detection, so it's easy to for something to be interrupted or fail and leave the lock file behind. And unless I'm missing something, there's no protection from multiple processes stomping on each other.

    It's easy to fix, after you spend time trying to debug it, give up, and go on a web search that eventually leads to this bug.

    I wonder if initializing _zplug_lock with a unique name (include pid?) would mitigate this.

  23. garyo commented on Jun 29, 2024

    @garyo

    Just chiming in -- ended up here after a long search starting with "no job control in this shell" in my MacOS Terminal. Finally remembered I installed zplug a few weeks ago. Removing the lock file fixed it for me. What is the lock file for? Can I rm -f ~/.zplug/log/job.lock in my init file to prevent this in the future?

  24. kirkegaard commented on Dec 4, 2024

    @kirkegaard

    I ended up in this same situation and i did not have a job.lock file. Turns out that i for some reason installed zplug using brew but also via the install script. Removing one of them fixed it for me

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions