-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Port ZipArchiveTest #10099
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
Port ZipArchiveTest #10099
Conversation
- PR: scala/scala#9230 - issue: scala/bug#11754 Co-authored-by: Som Snytt <[email protected]>
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.
Otherwise, LGTM
archive.close() | ||
// The following results in IOException on Windows (file in use by another process). | ||
// As jar is a temp file, it will be deleted automatically. | ||
// Files.delete(jar) |
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.
Maybe it is better to try to delete it
try Files.delete(jar) catch case _: IOException => ()
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.
Or make it conditional using System.getProperty("os.name")
.
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.
This way we would at least test that we can delete it in a non-Windows OS.
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.
Do you know what is using the jar?
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.
It seems to be Windows-specific --- it should not be used as on Linux machines.
|
||
private[this] var closeables: List[java.io.Closeable] = Nil | ||
override def close(): Unit = { | ||
closeables.foreach(_.close) |
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.
We can simpli
closeables.foreach(_.close) | |
closeables.foreach(_.close) | |
closeables = Nil |
The test catches an infinite recursion in ZipArchive
Co-authored-by: Som Snytt [email protected]