Skip to content

Fix(system_subprocess): save_completed_state passing stderr instead of stdin to callback#1159

Merged
jvdp1 merged 4 commits intofortran-lang:masterfrom
Mahmood-Sinan:system_run_sync_arg_error
Apr 10, 2026
Merged

Fix(system_subprocess): save_completed_state passing stderr instead of stdin to callback#1159
jvdp1 merged 4 commits intofortran-lang:masterfrom
Mahmood-Sinan:system_run_sync_arg_error

Conversation

@Mahmood-Sinan
Copy link
Copy Markdown
Contributor

Fixes incorrect argument mapping in process_callback inside save_completed_state subroutine where process%stderr was passed twice, causing stdin to be omitted. In one place process%stderr was being passed in place of process%stdin. This change correctly passes process%stdin.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 26, 2026

Codecov Report

❌ Patch coverage is 96.42857% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 68.81%. Comparing base (d30e087) to head (abb8ba4).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
test/system/test_subprocess.f90 96.42% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1159      +/-   ##
==========================================
+ Coverage   68.73%   68.81%   +0.07%     
==========================================
  Files         408      408              
  Lines       13697    13726      +29     
  Branches     1543     1552       +9     
==========================================
+ Hits         9415     9445      +30     
+ Misses       4282     4281       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Member

@perazz perazz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch, thank you for fixing that @Mahmood-Sinan. Would it be possible to add a test routine that exercises using stdin with a process completion callback ?

@Mahmood-Sinan
Copy link
Copy Markdown
Contributor Author

Nice catch, thank you for fixing that @Mahmood-Sinan. Would it be possible to add a test routine that exercises using stdin with a process completion callback ?

Thanks for reviewing. I have added the test for callback. I had to use a wrapper for payload because array of character strings were getting converted into a scalar variable in callback subroutine. Please take a look.

Copy link
Copy Markdown
Member

@jvdp1 jvdp1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you @Mahmood-Sinan . Here are a few suggestions

Comment thread test/system/test_subprocess.f90 Outdated

implicit none

type :: payload_wrapper
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could be the DT string_type of stdlib used?

Copy link
Copy Markdown
Contributor Author

@Mahmood-Sinan Mahmood-Sinan Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I tried, the compiler gave me an error saying that

  193 |             type is (string_type)
      |                                 1
Error: The type-spec shall not specify a sequence derived type or a type with the BIND attribute in SELECT TYPE at (1) [F2003:C815]

I suppose we cannot do so, since string_type has sequence attribute.

Comment thread test/system/test_subprocess.f90 Outdated
Comment thread test/system/test_subprocess.f90 Outdated
@Mahmood-Sinan
Copy link
Copy Markdown
Contributor Author

@jvdp1 Thanks for reviewing. I have made the changes.

@Mahmood-Sinan
Copy link
Copy Markdown
Contributor Author

@jvdp1 please check.

Copy link
Copy Markdown
Member

@jvdp1 jvdp1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @Mahmood-Sinan . LGTM.
Could you merge the master branch back to resolve the CI issue, please? Then it will be ready to be merged IMO.

@Mahmood-Sinan
Copy link
Copy Markdown
Contributor Author

@jvdp1 I have merged rhe master branch. Please check.

@jvdp1
Copy link
Copy Markdown
Member

jvdp1 commented Apr 10, 2026

thank you @Mahmood-Sinan . I'll merge it.

@jvdp1 jvdp1 merged commit a0471de into fortran-lang:master Apr 10, 2026
90 of 91 checks passed
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.

3 participants