Github user srowen commented on the pull request:
https://github.com/apache/spark/pull/2393#issuecomment-55728033
@chenghao-intel For example, in `FileServerSuite`:
```
override def beforeAll() {
super.beforeAll()
tmpDir = Files.createTempDir()
tmpDir.deleteOnExit()
...
}
...
override def afterAll() {
super.afterAll()
Utils.deleteRecursively(tmpDir)
}
```
This makes a temp dir in the right place, asks the JVM to delete it on
shutdown, but also tries to delete it explicitly after the test finishes.
(Looks like `FileUtils.deleteDirectory` duplicates
`Utils.deleteRecursively`?)
I was not sure if `deleteOnExit()` works in the case of Ctrl-C, but a quick
test here suggests it does. It won't work in the case of hard failures, but
nothing will really.
The risk with `Signal` is that by trapping Ctrl-C (and this requires a
non-public Sun API anyway) you become unkillable if the handler blocks for some
reason.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]