parent
d2f9bc8d80
commit
56c3ab4ff8
|
@ -382,10 +382,10 @@ void expand_token(Token&& token, const Context& context, const ShellContext& she
|
||||||
return set_target(params);
|
return set_target(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
const int arg = str_to_int(content)-1;
|
const int arg = str_to_int(content);
|
||||||
if (arg < 0)
|
if (arg < 1)
|
||||||
throw runtime_error("invalid argument index");
|
throw runtime_error("invalid argument index");
|
||||||
return set_target(arg < params.size() ? params[arg] : String{});
|
return set_target(arg <= params.size() ? params[arg-1] : String{});
|
||||||
}
|
}
|
||||||
case Token::Type::FileExpand:
|
case Token::Type::FileExpand:
|
||||||
return set_target(read_file(content));
|
return set_target(read_file(content));
|
||||||
|
|
1
test/regression/4601-int-min-arg/cmd
Normal file
1
test/regression/4601-int-min-arg/cmd
Normal file
|
@ -0,0 +1 @@
|
||||||
|
|
1
test/regression/4601-int-min-arg/in
Normal file
1
test/regression/4601-int-min-arg/in
Normal file
|
@ -0,0 +1 @@
|
||||||
|
|
1
test/regression/4601-int-min-arg/out
Normal file
1
test/regression/4601-int-min-arg/out
Normal file
|
@ -0,0 +1 @@
|
||||||
|
ok
|
5
test/regression/4601-int-min-arg/rc
Normal file
5
test/regression/4601-int-min-arg/rc
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
try %{
|
||||||
|
nop %arg{-2147483648}
|
||||||
|
} catch %{
|
||||||
|
exec iok<esc>
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user