Closed StandingPadAnimations closed 1 year ago
Creating discord_msg.txt
on /tmp
will make 2 clients interfere with each other when running in the same machine.
Use a unique file name. Something like discord_msg_$$.txt
where $$
is the current process ID.
And don't forget to delete it. It's annoying to see 50 or so files in /tmp
. Some people don't restart their machines for weeks.
Alright I've now made it so the message file includes the PID of the instance, and I've also added deleting the file whenever any error occurs (with the exception of file creation since I'm not sure if the file would exist when there's an error in creating the file).
Sorry about the extra commit. I was working on image viewer support and pushed to the wrong branch.
Why not defer the
os.Remove(msg_file)
call instead of calling it twice?
Again, this is my first time even touching Go, so stuff like deferring is new to me
Alright I've added the suggested change to os.CreateTemp()
. It seems to drastically reduce the amount of code needed for creating the file.
@StandingPadAnimations Can you change this PR so it can be merged with the new file locations?
Sorry for the long wait, I've now updated this branch
On 23/07/20 07:56PM, StandingPad wrote:
Sorry for the long wait, I've now updated this branch
-- Reply to this email directly or view it on GitHub: https://github.com/ayn2op/discordo/pull/302#issuecomment-1644915941 You are receiving this because you commented.
Message ID: @.***>
Good.
--
For some reason, maybe a quirk of my terminal or a Go quirk, Discordo couldn't launch an editor. Launching Neovim would hang and Nano would stright up fail. Some poking around found that it was due to Stdout. For some reason, setting Stdout to a string just didn't work.
Now I could try to capture Stdout, but I decided to opt for the simple route of "create a temporary file and extract the message from there".
This is my first time touching Go at all, so it's not the best, but it fixes this issue.