https://pantsbuild.org/ logo
a

ancient-vegetable-10556

09/28/2021, 5:49 PM
What’s the best way to capture stdout from a process to a file? (I’m looking to concatenate a bunch of files together and store the results, and
cat
seems to only output things to stdout)
h

hundreds-father-404

09/28/2021, 5:57 PM
Using Pants? Or using shell?
a

ancient-vegetable-10556

09/28/2021, 5:57 PM
in pants
h

hundreds-father-404

09/28/2021, 5:57 PM
You would run a
Process
and then pipe
ProcessResult.stdout
into
CreateDigest()
a

ancient-vegetable-10556

09/28/2021, 5:58 PM
It looks like
ProcessResult.stdout
is a string, and not a pipe, which would materialise the results of the process into memory (bad)
I guess I could run
bash -c "cat file1 file2 > outputfile"
h

hundreds-father-404

09/28/2021, 5:59 PM
Oh I think i see what you're asking now. Yeah, and then use
Process(output_files=)
Indeed, you need some way for the process itself to right directly to a file
what is the underlying process?
a

ancient-vegetable-10556

09/28/2021, 5:59 PM
it’s cat
🐈 3
w

witty-crayon-22786

09/28/2021, 6:27 PM
yea, use a bash process: grep for
BashBinary
a

ancient-vegetable-10556

09/28/2021, 6:29 PM
Yup, I found BashBinary, just wanted to make sure I wasn’t missing anything