Skip to content

Commit

Permalink
Never remove tmpdir
Browse files Browse the repository at this point in the history
In windows trying to remove a file/directory being used may cause
an error - samgiles/rs-mktemp#5 will then
cause us to panic. For now leak the tmpdir and release early.
  • Loading branch information
equalsraf committed Apr 26, 2017
1 parent 8d3474c commit d86c9d2
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions ff/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ impl Browser {
pub fn start(port: Option<u16>) -> Result<Self, RunnerError> {

let mut tmpdir = mktemp::Temp::new_dir()?;

// release tempdir here, because ultimately we may want to exit after
// launching firefox, in which case we cannot remove that tmp dir
//
// FIXME: we could release later, but in windows this causes errors because
// of https://github.com/samgiles/rs-mktemp/pull/5
// do it here even if we leak the tmpdir
tmpdir.release();

let mut profile = Profile::new(Some(tmpdir.as_ref()))?;

// racy but see https://bugzilla.mozilla.org/show_bug.cgi?id=1240830
Expand Down Expand Up @@ -84,9 +93,6 @@ impl Browser {
retry += 1;
}

// release tempdir here, because ultimately we may want to exit after
// launching firefox, in which case we cannot remove that tmp dir
tmpdir.release();
Ok(Browser {
runner: runner,
connection: connection,
Expand Down

0 comments on commit d86c9d2

Please sign in to comment.