cli icon indicating copy to clipboard operation
cli copied to clipboard

Passing file descriptor numbers to avoid tempfiles

Open lassik opened this issue 5 years ago • 2 comments

Continuing from https://github.com/Unibeautify/unibeautify-cli/issues/82#issuecomment-426633766

The file descriptor support seemed weird at first but it's starting to grow on me. Tempfiles are the bane of inter-process communication. It's much cleaner to pass everything around with pipes. If we support routing output to arbitrary file descriptors, callers can create a pipe for every kind of output they need, then just assign the pipes to pre-determined file descriptors and tell unibeautify about those fd numbers. No tempfiles ever 🎉

And from https://github.com/Unibeautify/unibeautify-cli/issues/82#issuecomment-431613985

No tempfiles ever 🎉

@lassik A goal I share. I'd be open to receiving a Pull Request implementing this. Of course, we need to continue support for Linux, Mac, and Windows.

Linux, Mac and all other unixes are easy - passing around file descriptor numbers has a long history there and the relevant APIs are extremely stable.

After investigating for a bit, I think it can be done the same way one Windows, but not sure if there are any gotchas.

lassik avatar Oct 21 '18 09:10 lassik