-
Notifications
You must be signed in to change notification settings - Fork 597
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
Automatically schedule temporary resource files for delete on exit. #4616
Conversation
try { | ||
File tempLibSourceDir = IOUtils.tempDir("RlibSources.", ""); | ||
File tempLibInstallationDir = IOUtils.tempDir("Rlib.", ""); |
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.
For consistency with BaseTest.createTempDir()
, I think that IOUtils.tempDir()
should register the temp dir for recursive deletion on exit via IOUtils.deleteRecursivelyOnExit()
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.
Done.
* @param targetDir target directory where the File should be written | ||
* @return the newly created File containing the library | ||
*/ | ||
public File writeLibrary(final File targetDir) { |
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.
Can you have this method register its libraryFile for deletion on exit using createTempFile(), rename the method and adjust the javadoc appropriately? You'll need to add an overload of createTempFile() that takes a directory argument.
try { | ||
return executeScript(tempResourceFile.getAbsolutePath(), pythonProcessArgs, scriptArgs); | ||
} finally { | ||
FileUtils.deleteQuietly(tempResourceFile); |
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.
Might want to consider keeping this -- it doesn't hurt to delete early when possible, despite the delete on exits.
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.
Review complete, back to @cmnbroad
5da784d
to
1a33c3f
Compare
1a33c3f
to
99d93e8
Compare
Codecov Report
@@ Coverage Diff @@
## master #4616 +/- ##
===============================================
+ Coverage 80.131% 80.333% +0.202%
- Complexity 17488 17762 +274
===============================================
Files 1085 1087 +2
Lines 63245 64310 +1065
Branches 10200 10533 +333
===============================================
+ Hits 50679 51662 +983
- Misses 8579 8603 +24
- Partials 3987 4045 +58
|
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.
👍 latest version looks good -- merging
Fixes #4577.