-
-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to set tmpdir to false to disable using temp directory #251
Conversation
32e4ce8
to
ef06d1c
Compare
I think I'm missing something - what is the downside to specifying FYI, If we want to move forward with this PR after more information is gathered:
|
The issue is — Yes, as a workaround, I can specify tmpdir for each Originally, I was not aware of
I will add test and doc. |
I think I'm going to defer to one of the other maintainers as to whether this should be merged (pending the test/doc fixes). |
In addition to @malept's thought about specifying a unique I might be able to fathom a performance argument for this (since it presumably avoids one set of copy operations), but I can't really see a functionality argument, or whether it's worth the complexity it adds in terms of code paths. I suppose one question I should be asking (cc @maxogden?) is, historically, what was the main motivation for copying to Additionally:
|
From my point of view, it smells bad. Because instead of fixing issue in the lib (electron-packager) I fix issue on my side. i. e. "I don't want to improve underlying library".
Currently, only tests does so. Because:
So, yes, the question is why I still ask you ability to disable temp dir usage? It is described in the "Why" section in my first comment. Currently, temp dir is not required for me at all and just adds complexity.
Thanks, fixed (will be pushed in a few minutes after test).
Because
means: copy So, we must exclude outDir because destination folder inside source folder if we don't use temp directory (it leads to cryptic errors "filename too long" if we don't exclude it). |
ef06d1c
to
7e1f6f0
Compare
Could you extract the |
If you would like to finish #155, even better! |
I must confess I read this thread and am confused about what is actually being proposed. IMO we should just make the folder name random to support parallel builds, I think that's a valid use case. It will be a one line fix also. |
It would be more than a one-line change. IIRC right now we are only actually deleting the tmp directory on the start of the next run, which won't know the value from the previous run. We could presumably solve that either by deleting it at the end of a run (both in cases of success and failure) or by globbing for a common prefix we'd expect to use for all tmp folders. Given that part of the reasoning for this PR is to just allow less file copying altogether, though, my previous question of "why does electron-packager use a tmpdir to begin with and would not using one be bad" also stands. |
@kfranqueiro ah good points, I guess it is non-trivial to support parallel builds in the tmpdir. To answer your question, the tmpdir is just a staging area so that the unzip -> rename -> modify cycle can happen somewhere that won't leave an inconsistent state in the users directory in the case of a crash. E.g. if the unzip fails halfway through, or the packager crashes halfway through. If we leave the tmpdir in an inconsistent state it doesnt matter, we can just delete it. Maybe that isn't an actual concern people have, but it seemed like a good idea at the time. Now it seems like the simplest option would be to allow the staging directory to be specified, and default it to tmpdir |
I agree RE avoiding an inconsistent state, which is probably why I vaguely recall leaving tmpdir cleanup at the beginning of the process when I refactored stuff in #88.
Isn't that what the |
@kfranqueiro Ah ok, just grokked the convo here. I am still +1 to a staging area. I'd rather have the failure state of electron-packager be to not leave a bunch of in-progress files all over a directory. Also, good point re: the --tmpdir option, that fixes the parallel builds issue (this is the first time parallel builds have been requested). I don't think it's a hack to specify different --tmpdirs, seems perfectly reasonable to me. So basically that judgment that needs to be made here is if its worth it to add an option that touches a lot of existing code so that @develar can avoid a copy operation in his test suite. I would personally rank the importance of a feature like this pretty low since it's a lot of effort for very little upside, but if this PR got some tests added to it then I would be OK merging it now since most of the work is already done at this point anyway. |
@@ -21,6 +21,10 @@ if (!args.dir || (!args.all && (!args.platform || !args.arch))) { | |||
process.exit(1) | |||
} | |||
|
|||
if (args.tmpdir === 'false') { | |||
args.tmpdir = false | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather handle this by setting the boolean
flag for this argument in the minimist
options (cli.js)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I commented related to this earlier; I suspect using the boolean flag is unsafe because tmpdir is normally a string (the location of the staging area); it is being overloaded basically to have false treated as a special value so that the staging area can be disabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, cannot be marked as "boolean". If you don't like this handling, maybe it will be better to add additional option use-temp-dir
(default value: true) (but tmpdir
and use-temp-dir
are mutually exclusive, so, I think, it is better to allow specify false
)?
2ff8c43
to
e545aa9
Compare
Just noting that this PR is now blocked on #255. |
e545aa9
to
1d5a5fa
Compare
…g directory and we exclude previous artifacts directories)
…ect — version property was deleted from prototype
1d5a5fa
to
6623c25
Compare
A new PR would be good. |
I use electron-packager programmatically in electron-complete-builder.
Currently, electron-packager cannot be used in parallel —my tests failed (I use ava). Because electron-packager uses one predefined temp directory instead of random —
path.join(opts.tmpdir || os.tmpdir(), 'electron-packager')
This pull request doesn't fix it. Instead, I ask you ability to disable using of temp dir. And just use specified
out
directly.Why?
electron-complete-builder
— it is already implemented on my side.