Skip to content

Commit

Permalink
use tmp direct so doesn't have to be added to path
Browse files Browse the repository at this point in the history
  • Loading branch information
bcpeinhardt committed Jan 7, 2023
1 parent af3f09f commit 4f5b1e3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,22 @@ where
}

pub fn install_drivers() {
std::fs::create_dir_all("/tmp/webdrivers").expect("Could not create webdrivers directory");
Driver::Chrome
.install()
.install_into(PathBuf::from("/tmp/webdrivers"))
.expect("Could not install chromedriver");
Driver::Gecko
.install()
.install_into(PathBuf::from("/tmp/webdrivers"))
.expect("Could not install geckodriver");
}

pub fn start_drivers() -> (Child, Child) {
let geckodriver = Command::new("geckodriver")
let geckodriver = Command::new("/tmp/webdrivers/geckodriver")
.stdout(Stdio::null())
.stderr(Stdio::null())
.spawn()
.expect("Could not start geckodriver");
let chromedriver = Command::new("chromedriver")
let chromedriver = Command::new("/tmp/webdrivers/chromedriver")
.stdout(Stdio::null())
.stderr(Stdio::null())
.spawn()
Expand Down

0 comments on commit 4f5b1e3

Please sign in to comment.