1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-22 15:10:44 -05:00

test(cli/inspector_port_collision): fail rather than hang (#6991)

This commit is contained in:
Bert Belder 2020-08-08 20:01:54 +02:00
parent f22b7dc783
commit 9806933f57
No known key found for this signature in database
GPG key ID: 7A77887B2E2ED461

View file

@ -2934,10 +2934,10 @@ async fn inspector_port_collision() {
.unwrap();
let stderr_1 = child1.stderr.as_mut().unwrap();
let mut stderr_lines_1 = std::io::BufReader::new(stderr_1)
let mut stderr_1_lines = std::io::BufReader::new(stderr_1)
.lines()
.map(|r| r.unwrap());
let _ = extract_ws_url_from_stderr(&mut stderr_lines_1);
let _ = extract_ws_url_from_stderr(&mut stderr_1_lines);
let mut child2 = util::deno_cmd()
.arg("run")
@ -2947,15 +2947,13 @@ async fn inspector_port_collision() {
.spawn()
.unwrap();
use std::io::Read;
let mut stderr_str_2 = String::new();
child2
.stderr
.as_mut()
.unwrap()
.read_to_string(&mut stderr_str_2)
.unwrap();
assert!(stderr_str_2.contains("Cannot start inspector server"));
let stderr_2 = child2.stderr.as_mut().unwrap();
let stderr_2_error_message = std::io::BufReader::new(stderr_2)
.lines()
.map(|r| r.unwrap())
.inspect(|line| assert!(!line.contains("Debugger listening")))
.find(|line| line.contains("Cannot start inspector server"));
assert!(stderr_2_error_message.is_some());
child1.kill().unwrap();
child1.wait().unwrap();