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

Feature Request: Support for Executing Custom Commands on VS Code Exit #240582

Closed
obie opened this issue Feb 12, 2025 · 1 comment
Closed

Feature Request: Support for Executing Custom Commands on VS Code Exit #240582

obie opened this issue Feb 12, 2025 · 1 comment
Assignees

Comments

@obie
Copy link

obie commented Feb 12, 2025

I propose adding a feature to Visual Studio Code that allows users to specify custom commands to be executed automatically when the editor closes. This functionality would provide greater control over managing development environments, especially where auxiliary processes (such as spring in Ruby on Rails) continue running after a session ends.

Problem Scenario:

While developing Ruby on Rails applications, we often use tools like Spring to speed up command executions. However, these processes can remain active even after VS Code is closed, leading to unnecessary memory and CPU usage.

Proposed Solution:

Introduce a setting in settings.json where users can list commands to be executed upon the editor's exit, allowing for seamless automation:

{
  "onExit": ["bin/spring stop", "custom_command"]
}

Benefits:

  • Resource Optimization: Automatically terminating lingering processes ensures efficient use of system resources.
  • Improved Workflow: Automatic cleanup provides a smoother development experience by eliminating the need for manual process termination.

Overall, this feature would enable users to tailor their development environment teardown to their specific needs, enhancing productivity and system performance. Thank you for considering this enhancement!

@meganrogge
Copy link
Contributor

Thank you for your suggestion regarding the addition of an onExit command execution feature in Visual Studio Code. While we appreciate your idea and understand the problem you're aiming to solve, we have several reasons for not implementing this functionality:

  1. Security and Risk Concerns
    Allowing arbitrary commands to be executed automatically on VS Code’s exit introduces potential security risks. Malicious extensions or configurations could exploit this feature to execute harmful commands without user consent, leading to unintended consequences such as data loss, privilege escalation, or system compromise.

  2. Unpredictability and Stability Issues
    The shutdown process of VS Code is designed to be fast and deterministic. Running arbitrary commands on exit could lead to inconsistencies, such as delayed shutdowns, unexpected failures, or incomplete terminations if a command hangs or fails.

  3. Cross-Platform Variability
    Ensuring consistent behavior across different operating systems (Windows, macOS, and Linux) would be challenging. Some platforms may handle process termination differently, leading to inconsistent execution of onExit commands or unwanted behavior like zombie processes persisting.

VS Code is primarily an editor, and managing external processes upon exit falls outside its intended scope. Developers typically manage their runtime environments separately, using task runners, service managers, or scripts.

@meganrogge meganrogge closed this as not planned Won't fix, can't repro, duplicate, stale Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants