diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2023-03-30 10:43:16 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-30 10:43:16 -0400 |
commit | e0429e2ad641e9207e00838de209ce33b3562f70 (patch) | |
tree | 496c38dadb79c4dc9ae4eea755e2ac6a65440ad4 /test_util/src/pty.rs | |
parent | 3deade4b14de809f67ed0471f8e91c91b25fedcc (diff) |
fix(repl): improve package.json support (#18497)
1. Fixes a cosmetic issue in the repl where it would display lsp warning
messages.
2. Lazily loads dependencies from the package.json on use.
3. Supports using bare specifiers from package.json in the REPL.
Closes #17929
Closes #18494
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, |