Skip to content

Add the ability to specify stdin to pass to a sub-command. #64

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

Merged
merged 1 commit into from
Jul 7, 2020

Conversation

ltratt
Copy link
Member

@ltratt ltratt commented Jul 6, 2020

No description provided.

//! * `stdin: <string>`, text to be passed to the command's `stdin`. If the command exits without
//! having consumed all of `<string>`, an error will be raised. Note, though, that operating
//! system file buffers can mean that the command *appears* to have consumed all of `<string>`
//! without it actually having done so.
Copy link
Contributor

Choose a reason for hiding this comment

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

E.g. You have a bunch of newlines in your input string?

Copy link
Member Author

Choose a reason for hiding this comment

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

The problem is even simpler than that: the OS and/or filesystem library might buffer input. So we might write to the pipe, see that the input has disappeared, and assume that it was read by the command; but the input might be in an intermediate buffer and the program can exit without ever actually having read it. I'm not aware that we can do anything about this.

Copy link
Member

Choose a reason for hiding this comment

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

That matches my interpretation of the docstring.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah I understand. Thanks!

Copy link
Contributor

@jacob-hughes jacob-hughes left a comment

Choose a reason for hiding this comment

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

Cool feature. I can see this being useful. LGTM with the caveat that I'm not too familiar with the poll syscall.

@ltratt
Copy link
Member Author

ltratt commented Jul 6, 2020

Oops, forgot to add @vext01 to this.

@vext01
Copy link
Member

vext01 commented Jul 6, 2020

LGTM

@ltratt
Copy link
Member Author

ltratt commented Jul 6, 2020

OK, so it sounds like we can merge?

@vext01
Copy link
Member

vext01 commented Jul 6, 2020

There's one outstanding comment from Jake, so I'll let him do the merge once he's happy.

@ltratt
Copy link
Member Author

ltratt commented Jul 7, 2020

@vext01 I think we might want to, and be able to, go ahead with this one. Please have a look at my reply to Jake's question and see if you think it's been addressed or not.

@vext01
Copy link
Member

vext01 commented Jul 7, 2020

bors r+

@bors
Copy link
Contributor

bors bot commented Jul 7, 2020

Build succeeded:

@bors bors bot merged commit 4c65a4a into softdevteam:master Jul 7, 2020
bors bot added a commit to softdevteam/ykbf that referenced this pull request Jul 9, 2020
4: Use lang_tester r=vext01 a=ltratt

Needs #3 and softdevteam/lang_tester#64 to be merged first (and a new release of lang_tester to be made).

Co-authored-by: Laurence Tratt <laurie@tratt.net>
bors bot added a commit to softdevteam/ykbf that referenced this pull request Jul 9, 2020
4: Use lang_tester r=vext01 a=ltratt

Needs #3 and softdevteam/lang_tester#64 to be merged first (and a new release of lang_tester to be made).

Co-authored-by: Laurence Tratt <laurie@tratt.net>
@ltratt ltratt deleted the stdin branch July 13, 2020 22:25
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