Add the ability to set stdin for a Process#22976
Add the ability to set stdin for a Process#22976svenier wants to merge 14 commits intopantsbuild:mainfrom
Conversation
Cursor written changes pass cargo testing, but python tests hang. Committing to move to a new client that with a more consistent python setup in case that hang is from the version problems.
Passes relevant cargo and pants tests. Still needs to be tried with a real build process. Also needs a round of review & cleanup of the Cursor generated code - especially the rust.
Delete a bunch of leftover logger calls
benjyw
left a comment
There was a problem hiding this comment.
Thanks for this contribution! Some comments so far.
Remove superfluous comments, debug prints, and tests. Default stdin on Process to None to preserve the distinction between no stdin and stdin of a 0-byte string. Error out on remote execution with stdin instead of forcing to local
|
Looks good overall. Let us know when this is out of Draft state and ready for a full review. |
Added one sentence to the release notes. Made all of the fixes required by both rust and python lint tools
benjyw
left a comment
There was a problem hiding this comment.
Code looks great, a clarification on a comment would be useful. Thanks!
|
Comments addressed. Question: Should the AI disclosure stay in the PR description above (which I think I read ends up in the commit message) or should it move to just a comment on the discussion? |
Moving it to a comment makes sense. |
benjyw
left a comment
There was a problem hiding this comment.
Looks great! Just one minor nit on one of the comments. Let me know when this is ready and I'll trigger one last CI run, and then merge on green.
|
AI Disclosure: Changes were made by an AI agent and review by multiple humans. Unfortunately, none of them are Rust experts, so some special attention is warranted there. |
|
@benjyw All set! Thanks for your guidance on this. |
Move use statement out of a local block up to the top of the file
|
Regarding REAPI support, Pants already has the ability to generate a wrapper script around remote executions. Stdin support would just be another item for the wrapper script to handle. See maybe_make_wrapper_script. |
Oh, hello! Can this be an improvement in a future version or should I flip this back to a draft so I don't merge it with the remote execution restriction in place? |
In my view, it would depend on which release this PR ends up in. If it goes out as is in 2.31, then users would be able to observe a difference in behavior between local processes and remote execution processes. My vote would be to avoid that if we can. But if it will go out in 2.32, then deferring the remote execution support to a separate PR seems fine. |
|
@tdyas how complicated would it be to enhance that script? I'm guessing "not very"? |
Very straightforward:
|
@cburroughs already asked to hold this until 2.32. |
|
This is probably going to require a change to the UI since currently the Process object just gets Bytes for stdin, not a Digest. Since that's a big of a big change, I'll flip this back to a draft and send out pings when I get the changes done. |
|
Sure, but if the |
|
Thanks for the contribution. We've just branched for 2.31.x, so merging this pull request now will come out in 2.32.x, please move the release notes updates to docs/notes/2.32.x.md if that's appropriate. |
This adds a new optional field to Process objects of the bytes to be passed into the command's stdin. This has the unfortunate side effect of forcing the command to run locally because the Remote Execution API doesn't support stdin (yet).
This is in support of #22918