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

Terminal exit fails when spawning vivify-server #169

Closed
palomino79 opened this issue Aug 29, 2024 · 3 comments · Fixed by #171
Closed

Terminal exit fails when spawning vivify-server #169

palomino79 opened this issue Aug 29, 2024 · 3 comments · Fixed by #171
Labels
type:bug Something isn't working

Comments

@palomino79
Copy link

Description

When running the viv shell script that starts a new server process in the background and then monitors the process with monitor_server, the terminal fails to close properly if the user attempts to exit the terminal while the script is still running. The monitor_server function, which continuously checks the server's status, remains attached to the terminal session, preventing the terminal from closing.

To Reproduce

  1. Do not have a running vivify-server instance.
  2. Open a markdown file for preview with the command viv some_file.md
  3. Attempt to exit the terminal, such as by issuing the exit command to the terminal.

Context

Expected Behavior:

The terminal should close normally after starting the script, with all background processes continuing to run independently.

Actual Behavior:

The terminal fails to close and remains open until the monitor_server function or the server process completes. This prevents the terminal from exiting, requiring manual intervention to close the terminal.

My operating system is:

Linux (flavor of Linux shouldn't matter for this problem).

Running viv --version outputs:

vivify-server v0.5.0

I installed Vivify in the following way (e.g. name of the package manager, self-compiled or development mode):

Self-compiled.

This is what happens when I kill any running instance of Vivify with killall vivify-server and then run vivify-server at the absolute installation path (e.g. at command -v vivify-server) instead of viv and try to reproduce the problem:

The issue is purely in the viv executable script and how it monitors the server process.

@jannis-baum
Copy link
Owner

Interesting! Thanks for reporting this. I never realized that monitor_server doesn't exit because this doesn't prevent my shell or terminal from exiting for some reason like it does for you.

Anyways, should be fixed in #171, could you check that? Thanks!

@palomino79
Copy link
Author

palomino79 commented Aug 29, 2024

@jannis-baum Oh, man, you just beat me to it. I had a different idea of just disowning the function, but I'll see if your commit fixes the issue. Thanks. I'll close out the PR I just made.

Edit: Yep, looks like moving the test outside the conditional did the trick.

@jannis-baum
Copy link
Owner

I released 0.5.1 with the fix. Thanks again for your help!

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