You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm creating this issue as a precursor to the PR discussed in #501 as while I have started looking at the problem and having some ideas on how to fix it, 1) I am not a regular Go programmer, and 2) I need some guidance on how this should fit into arkade.
Instead of using what os.TempDir returns (i.e. /tmp or equivalent) arkade should create a unique tempdir for all writes - e.g the following (which creates unique dirs with the prefix 'arkade'):
ioutil.TempDir("", "arkade")
This directory needs to exist before any writes are made, and be cleaned up when arkade exits. I think the easiest approach is to make a utility function that when called creates this tempdir (if it hasn't already been done) and returns it's path. Then all the places that currently call os.TempDir can call this function instead. I'm guessing somewhere in pkg/download would be a good place for this to live?
Equally, there should be a 'cleanup' function called when arkade is finished. I'm not sure where this should be added, or where it should be called from?
Let me know if you think this approach is a viable one, and where the best places to insert this new code is, and I'll start drafting a PR.
The text was updated successfully, but these errors were encountered:
You should be able to use a pattern like arkade-** in the method mentioned above along with a defer os.RemoveDir where any error is ignored. Do you want to try it and put up a Pr? I'll give some guidance at that point
I'm creating this issue as a precursor to the PR discussed in #501 as while I have started looking at the problem and having some ideas on how to fix it, 1) I am not a regular Go programmer, and 2) I need some guidance on how this should fit into arkade.
Instead of using what
os.TempDir
returns (i.e./tmp
or equivalent) arkade should create a unique tempdir for all writes - e.g the following (which creates unique dirs with the prefix 'arkade'):This directory needs to exist before any writes are made, and be cleaned up when arkade exits. I think the easiest approach is to make a utility function that when called creates this tempdir (if it hasn't already been done) and returns it's path. Then all the places that currently call
os.TempDir
can call this function instead. I'm guessing somewhere in pkg/download would be a good place for this to live?Equally, there should be a 'cleanup' function called when arkade is finished. I'm not sure where this should be added, or where it should be called from?
Let me know if you think this approach is a viable one, and where the best places to insert this new code is, and I'll start drafting a PR.
The text was updated successfully, but these errors were encountered: