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

Fix resource leak by using Unix.close_process_in instead of close_in #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mavci42
Copy link

@mavci42 mavci42 commented Jan 24, 2025

Fixed Resource Leak in get_command_output

The original code used close_in to close a process opened by Unix.open_process_in, which is incorrect and can lead to resource leaks. This PR fixes the issue by using Unix.close_process_in to properly close the process.

Changes:

  • Replaced close_in ic with Unix.close_process_in ic.
  • Ensured proper process termination even in case of exceptions.

Impact:

  • Prevents resource leaks.
  • Ensures correct process management.

- Replaced `close_in ic` with `Unix.close_process_in ic` to correctly close the process opened by `Unix.open_process_in`.
- Ensured that the process is properly closed even in case of exceptions (e.g., `End_of_file`).
- This prevents resource leaks and ensures proper process termination.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant