In jar-tool, close open files before trying to move them

Review Request #466 — Created June 8, 2014 and submitted

zundel
commons
zundel/fix-corrupt-across-filesystems
298
pants-reviews
jsirois, patricklaw
Close the files created by the JarWriter before attempting to move them.  The move might actually be a copy across filesystem boundaries.
Using Patrick's instructions I was able to first reproduce the problem, then after applying the fix the build worked for me.

First, setup a ramdisk wherever you like:

```
$ hdid -nomount ram://8192000
/dev/disk2
$ newfs_hfs -v "Demo Ramdisk" /dev/disk2
Initialized /dev/rdisk2 as a 4 GB case-insensitive HFS Plus volume
$ mkdir demo_ramdisk
$ mount -t hfs /dev/disk2 /Users/pl/demo_ramdisk
```

Then make that the temp dir for jar-tool:
```
$ git diff
diff --git a/pants.ini b/pants.ini
index 2806fd0..2a6ea66 100644
--- a/pants.ini
+++ b/pants.ini
@@ -264,6 +264,8 @@ jvm_args: ['-Xmx1g', '-XX:MaxPermSize=256m']
 [jar-publish]
 ivy_settings: %(pants_supportdir)s/ivy/ivysettings.xml

+[jar-tool]
+jvm_args: ['-Djava.io.tmpdir=/Users/pl/demo_ramdisk']

 [ide]
 python_source_paths: ['src/python']
```

Then run

`./pants goal bundle src/scala/com/pants/example:jvm-run-example`
PA
  1. Ship It!
  2. 
      
IT
  1. Ship It!
  2. 
      
ZU
Review request changed

Status: Closed (submitted)

Loading...