forked from extern/nushell
Check for left-unbounded range before external cmd
This commit is contained in:
parent
78054a5352
commit
8577d3ff41
@ -469,15 +469,6 @@ pub fn parse_call(
|
||||
spans: &[Span],
|
||||
expand_aliases: bool,
|
||||
) -> (Expression, Option<ParseError>) {
|
||||
// We might be parsing left-unbounded range ("..10")
|
||||
let bytes = working_set.get_span_contents(spans[0]);
|
||||
if let (Some(b'.'), Some(b'.')) = (bytes.get(0), bytes.get(1)) {
|
||||
let (range_expr, range_err) = parse_range(working_set, spans[0]);
|
||||
if range_err.is_none() {
|
||||
return (range_expr, range_err);
|
||||
}
|
||||
}
|
||||
|
||||
// assume spans.len() > 0?
|
||||
let mut pos = 0;
|
||||
let mut shorthand = vec![];
|
||||
@ -601,6 +592,14 @@ pub fn parse_call(
|
||||
err,
|
||||
)
|
||||
} else {
|
||||
// We might be parsing left-unbounded range ("..10")
|
||||
let bytes = working_set.get_span_contents(spans[0]);
|
||||
if let (Some(b'.'), Some(b'.')) = (bytes.get(0), bytes.get(1)) {
|
||||
let (range_expr, range_err) = parse_range(working_set, spans[0]);
|
||||
if range_err.is_none() {
|
||||
return (range_expr, range_err);
|
||||
}
|
||||
}
|
||||
parse_external_call(working_set, spans)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user