Skip to content

Commit

Permalink
Sleep between file copies and serve for macOS serve tests (#945)
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethloeffler authored Jul 20, 2024
1 parent 3ca975d commit 5f7dd45
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/rojo_test/serve_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,15 @@ impl TestServeSession {
.expect("Couldn't copy project to temporary directory");
};

// This is an ugly workaround for FSEvents sometimes reporting events
// for the above copy operations, similar to this Stack Overflow question:
// https://stackoverflow.com/questions/47679298/howto-avoid-receiving-old-events-in-fseventstream-callback-fsevents-framework-o
// We'll hope that 100ms is enough for FSEvents to get whatever it is
// out of its system.
// TODO: find a better way to avoid processing these spurious events.
#[cfg(target_os = "macos")]
std::thread::sleep(Duration::from_millis(100));

let port = get_port_number();
let port_string = port.to_string();

Expand Down

0 comments on commit 5f7dd45

Please sign in to comment.