|
1 | 1 | #[allow(deprecated)] |
2 | | -use nu_engine::{command_prelude::*, current_dir, get_eval_block}; |
| 2 | +use nu_engine::{command_prelude::*, current_dir, eval_call}; |
3 | 3 | use nu_protocol::{ |
4 | 4 | ast, |
| 5 | + debugger::{WithDebug, WithoutDebug}, |
5 | 6 | shell_error::{self, io::IoError}, |
6 | 7 | DataSource, NuGlob, PipelineMetadata, |
7 | 8 | }; |
8 | | -use std::path::{Path, PathBuf}; |
| 9 | +use std::{ |
| 10 | + collections::HashMap, |
| 11 | + path::{Path, PathBuf}, |
| 12 | +}; |
9 | 13 |
|
10 | 14 | #[cfg(feature = "sqlite")] |
11 | 15 | use crate::database::SQLiteDatabase; |
@@ -63,7 +67,6 @@ impl Command for Open { |
63 | 67 | #[allow(deprecated)] |
64 | 68 | let cwd = current_dir(engine_state, stack)?; |
65 | 69 | let mut paths = call.rest::<Spanned<NuGlob>>(engine_state, stack, 0)?; |
66 | | - let eval_block = get_eval_block(engine_state); |
67 | 70 |
|
68 | 71 | if paths.is_empty() && !call.has_positional_args(stack, 0) { |
69 | 72 | // try to use path from pipeline input if there were no positional or spread args |
@@ -192,13 +195,16 @@ impl Command for Open { |
192 | 195 |
|
193 | 196 | match converter { |
194 | 197 | Some((converter_id, ext)) => { |
195 | | - let decl = engine_state.get_decl(converter_id); |
196 | | - let command_output = if let Some(block_id) = decl.block_id() { |
197 | | - let block = engine_state.get_block(block_id); |
198 | | - eval_block(engine_state, stack, block, stream) |
| 198 | + let open_call = ast::Call { |
| 199 | + decl_id: converter_id, |
| 200 | + head: call_span, |
| 201 | + arguments: vec![], |
| 202 | + parser_info: HashMap::new(), |
| 203 | + }; |
| 204 | + let command_output = if engine_state.is_debugging() { |
| 205 | + eval_call::<WithDebug>(engine_state, stack, &open_call, stream) |
199 | 206 | } else { |
200 | | - let call = ast::Call::new(call_span); |
201 | | - decl.run(engine_state, stack, &(&call).into(), stream) |
| 207 | + eval_call::<WithoutDebug>(engine_state, stack, &open_call, stream) |
202 | 208 | }; |
203 | 209 | output.push(command_output.map_err(|inner| { |
204 | 210 | ShellError::GenericError{ |
|
0 commit comments