cli: Kill test validator if it starts too slowly. (#809)

This commit is contained in:
Alan O'Donnell 2021-09-28 10:30:19 -07:00 committed by GitHub
parent 3d21d33cd5
commit 5ba8252ccc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -1585,7 +1585,7 @@ fn start_test_validator(cfg: &Config, flags: Option<Vec<String>>) -> Result<Chil
// Start a validator for testing.
let test_validator_stdout = File::create(test_ledger_log_filename)?;
let test_validator_stderr = test_validator_stdout.try_clone()?;
let validator_handle = std::process::Command::new("solana-test-validator")
let mut validator_handle = std::process::Command::new("solana-test-validator")
.arg("--ledger")
.arg(test_ledger_filename)
.arg("--mint")
@ -1608,8 +1608,9 @@ fn start_test_validator(cfg: &Config, flags: Option<Vec<String>>) -> Result<Chil
std::thread::sleep(std::time::Duration::from_millis(1));
count += 1;
}
if count == 5000 {
println!("Unable to start test validator.");
if count == ms_wait {
eprintln!("Unable to start test validator.");
validator_handle.kill();
std::process::exit(1);
}