Skip to content

Fix missing error handling for IPC::Open3 in ipc_open3 subroutine#2078

Open
prjanitor wants to merge 1 commit intoClinical-Genomics:developfrom
prjanitor:prjanitor/9cc5eda2fba8d116cc298c3b6b015d786419109d
Open

Fix missing error handling for IPC::Open3 in ipc_open3 subroutine#2078
prjanitor wants to merge 1 commit intoClinical-Genomics:developfrom
prjanitor:prjanitor/9cc5eda2fba8d116cc298c3b6b015d786419109d

Conversation

@prjanitor
Copy link
Copy Markdown

Description

The ipc_open3 subroutine in lib/MIP/System_call.pm did not check if open3() succeeds before attempting to read from filehandles. If open3() fails, $writer, $reader, and $error will be undefined, causing silent failures or crashes when reading from undefined filehandles.

Changes

  • Added error handling after the open3() call to check if it succeeded
  • If open3() fails (returns undef), the subroutine now croaks with an informative error message including the command string and the system error
  • This prevents silent failures and makes debugging easier

Testing

The fix ensures that:

  1. If open3() fails, an error is raised immediately with context
  2. The filehandles are only accessed after confirming open3() succeeded
  3. The error message includes the command that failed for easier debugging

Closes #431


This PR was generated by PRJanitor — an automated tool that finds and fixes small bugs in open-source projects.

We respect your contribution guidelines — if your project doesn't accept bot PRs, we won't send more. You can also add a .github/prjanitor.yml file with enabled: false to opt out explicitly.

Add validation to check if open3() succeeds before attempting to read from filehandles. If open3() fails, $writer, $reader, and $error will be undefined, causing silent failures or crashes when reading from undefined filehandles.

Closes Clinical-Genomics#431
@prjanitor prjanitor requested a review from a team as a code owner April 2, 2026 05:55
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