diff options
Diffstat (limited to 'test_util/src/pty.rs')
-rw-r--r-- | test_util/src/pty.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/test_util/src/pty.rs b/test_util/src/pty.rs index 80d06881e..2f89e481e 100644 --- a/test_util/src/pty.rs +++ b/test_util/src/pty.rs @@ -1,5 +1,6 @@ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. +use std::borrow::Cow; use std::collections::HashMap; use std::collections::HashSet; use std::io::Read; @@ -35,7 +36,7 @@ impl Pty { read_bytes: Vec::new(), last_index: 0, }; - if args[0] == "repl" && !args.contains(&"--quiet") { + if args.is_empty() || args[0] == "repl" && !args.contains(&"--quiet") { // wait for the repl to start up before writing to it pty.expect("exit using ctrl+d, ctrl+c, or close()"); } @@ -151,6 +152,10 @@ impl Pty { }); } + pub fn all_output(&self) -> Cow<str> { + String::from_utf8_lossy(&self.read_bytes) + } + #[track_caller] fn read_until_with_advancing( &mut self, |