From 5a4bebb77080d8a72a3faa594a388c6bce46e346 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Sun, 30 Jun 2019 00:35:56 +0200 Subject: fix: test output for completions (#2597) --- cli/flags.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'cli') diff --git a/cli/flags.rs b/cli/flags.rs index 5e15a1e75..4d68ac726 100644 --- a/cli/flags.rs +++ b/cli/flags.rs @@ -8,6 +8,7 @@ use clap::SubCommand; use crate::deno_dir; use log::Level; use std; +use std::str; use std::str::FromStr; // Creates vector of strings, Vec @@ -671,11 +672,13 @@ pub fn flags_from_vec( } ("completions", Some(completions_match)) => { let shell: &str = completions_match.value_of("shell").unwrap(); + let mut buf: Vec = vec![]; create_cli_app().gen_completions_to( "deno", Shell::from_str(shell).unwrap(), - &mut std::io::stdout(), + &mut buf, ); + print!("{}", std::str::from_utf8(&buf).unwrap()); DenoSubcommand::Completions } ("eval", Some(eval_match)) => { -- cgit v1.2.3