unexpectedpanda / retool

Retool: a better filter tool for Redump and No-Intro DAT files.
BSD 3-Clause "New" or "Revised" License
354 stars 23 forks source link

Script Won't Output To File When Not TTY #324

Closed maxexcloo closed 6 months ago

maxexcloo commented 6 months ago

Describe the bug When running the script non interactively file outputs are not respected.

To reproduce Run retool non-interactively, the script will output the DAT files to the stdout instead of a file.

Expected behavior If --output is used, output to file.

Operating system macOS

Retool edition retool.py

Retool version v2.03.3

Additional context The problem lies in these two sections: https://github.com/unexpectedpanda/retool/blob/ea67f7ab02b9396d3e0a4f7b44a71910db286235/modules/config.py#L181-L182 https://github.com/unexpectedpanda/retool/blob/ea67f7ab02b9396d3e0a4f7b44a71910db286235/modules/output.py#L539-L546

unexpectedpanda commented 6 months ago

This was built like this so the output can be redirected for other programs to use. Speculatively perhaps, because as far as I know no one's actually using Retool this way...

If you can tell me what you're trying to do and provide me with a step-by-step to reproduce (I'm not very familiar with non-interactive shells and their purposes), I can take a look and see if this can be accommodated. At first glance it looks like a conditional to override the STDOUT output if --output is specified, and a check to make sure the request is coming from the CLI version might be enough.

maxexcloo commented 6 months ago

I'm trying to run it as a cron job - basically the tool runs every day and updates/cleans up my DAT files. For now I just manually removed that check and all is well for me.

Maybe it could check if --output is used? If used output to file as normal, if not output to STDOUT.

unexpectedpanda commented 6 months ago

Maybe it could check if --output is used? If used output to file as normal, if not output to STDOUT.

At first glance it looks like a conditional to override the STDOUT output if --output is specified, and a check to make sure the request is coming from the CLI version might be enough.

Looks like we're aligned then. I'll take a look when time allows.

unexpectedpanda commented 6 months ago

Changed in v2.03.4.