delete the mpv tmp file after creation#266
Conversation
Previously, a temporary path was not only being generated but also touched, therefore the os.Stat check to verify mpv had started was really doing nothing and just succeeding at the first attempt. Closes sentriz#265
|
@lucat1 any instructions on how to do so using docker? |
|
ah i see! thanks makes sense. i went with a slightly different version:
the reason being if we create a tmp file, delete it, create it again - there is a very very slim chance that is already exists. where as if we create a tmp dir then go will make sure there's no clash i did some light testing and seems to work - but let me know if not thanks! |
|
PS @marlop352 i just kicked off a job to build the nightly image here so when it's done you can test out the change with the sentriz/gonic:nightly tag |
|
@sentriz that's totally fine. Glad it's fixed now |
I tested the nightly image and it is working now. I just need to figure out how to force it to use the correct audio output. |
Previously, a temporary path was not only being generated but also touched, therefore the os.Stat check to verify mpv had started was really doing nothing and just succeeding at the first attempt.
Closes #265
In order to test on your machine (a Pi is not needed I believe) you can just add an
mpvsh script to your$PATH(before the actualmpv) with just asleep 10inside. This will simulate a somewhat slow process starting (what I guess happens on a Pi). Without this change, the error would have beenfailed to connectas the startup check would always return a false positive. Now it properly hangs for 5s and errors out withmpv never started.If you have the chance @marlop352, give this patch a try on your Pi. I don't currently have one on hand.