Skip to content

Add flushing and possible closing of stdin on run_shell_cmd#4664

Merged
boegel merged 2 commits intoeasybuilders:5.0.xfrom
Crivella:feature-stdin_flushclose
Oct 2, 2024
Merged

Add flushing and possible closing of stdin on run_shell_cmd#4664
boegel merged 2 commits intoeasybuilders:5.0.xfrom
Crivella:feature-stdin_flushclose

Conversation

@Crivella
Copy link
Copy Markdown
Contributor

@Crivella Crivella commented Oct 1, 2024

When using streaming_output and writing directly from the STDIN process pipe, commands that attempt to read from STDIN until EOF, or attempt to read a larger size than what is being passed will block.

An example of a bash command that will result in a blocking behavior

cat -

when executed via

cmd = f'cat -'
run_shell_cmd(cmd, stdin='Hello\nWorld\n')

Flushing and closing (in case of a non-interactive run) the STDIN as proposed in the changes would allow the example code to run

A test case has been added to catch such behavior

@Micket Micket added EasyBuild-5.0 EasyBuild 5.0 bug fix labels Oct 2, 2024
@Micket
Copy link
Copy Markdown
Contributor

Micket commented Oct 2, 2024

Seems important and straight forward enough to fix for 5.0

@Micket Micket added this to the 5.0 milestone Oct 2, 2024
Copy link
Copy Markdown
Member

@boegel boegel left a comment

Choose a reason for hiding this comment

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

lgtm

@boegel boegel merged commit 3f5edf5 into easybuilders:5.0.x Oct 2, 2024
@Crivella Crivella deleted the feature-stdin_flushclose branch October 2, 2024 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants