RecuperaBit icon indicating copy to clipboard operation
RecuperaBit copied to clipboard

support redirection and pipe in the commands

Open drzraf opened this issue 6 months ago • 1 comments

fix #9 based on (and replace) #129

Things like:

  • output redirection, eg: recoverable > /tmp/a.txt become possible (for any other command)
  • piping, eg: locate ... | grep foobar too
  • and combining of piping + redirection too, eg: help | grep z > /tmp/test.txt

The most painful part of the diff is switching from print() to return (so that Python output could be reused in subprocess.run()). Another option was to write the stdout write (intercepting print) but it sounded cumbersome.

drzraf avatar Jun 21 '25 18:06 drzraf

Thank you, this seems quite interesting, although I am getting several errors. I tried to run recoverable and first got an error related to list_parts, which I fixed by changing the line to this:

yield f"Partition #{i} -> {parts[part]}"

Now I am getting an error on the redirection part. Moreover, it seems that on Windows the file paths are being mangled, e.g. try to do this:

recoverable > C:\Users\name\Desktop\test.txt

It seems that Python is reading the backslash as an escape character.

Lazza avatar Jun 30 '25 10:06 Lazza