mirror of
https://github.com/sagiegurari/duckscript
synced 2024-10-14 11:53:05 +00:00
Alias based command implementations are not checked for variable leaks
This commit is contained in:
parent
13dd8b9d91
commit
c3570c1377
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
### v0.1.9
|
### v0.1.9
|
||||||
|
|
||||||
|
* Alias based command implementations are not checked for variable leaks.
|
||||||
* New get_home_dir command.
|
* New get_home_dir command.
|
||||||
* New array_join command.
|
* New array_join command.
|
||||||
* The read_properties command now support **--prefix** flag.
|
* The read_properties command now support **--prefix** flag.
|
||||||
|
|
|
@ -90,6 +90,8 @@ impl Command for AliasCommand {
|
||||||
if arguments.len() < self.arguments_amount {
|
if arguments.len() < self.arguments_amount {
|
||||||
CommandResult::Error("Invalid arguments provided.".to_string())
|
CommandResult::Error("Invalid arguments provided.".to_string())
|
||||||
} else {
|
} else {
|
||||||
|
let start_count = variables.len();
|
||||||
|
|
||||||
// define script arguments
|
// define script arguments
|
||||||
let mut handle_option = None;
|
let mut handle_option = None;
|
||||||
if !arguments.is_empty() {
|
if !arguments.is_empty() {
|
||||||
|
@ -198,9 +200,20 @@ impl Command for AliasCommand {
|
||||||
}
|
}
|
||||||
clear(&self.scope_name, variables);
|
clear(&self.scope_name, variables);
|
||||||
|
|
||||||
match flow_result {
|
let end_count = variables.len();
|
||||||
Some(result) => result,
|
if start_count != end_count {
|
||||||
None => CommandResult::Continue(flow_output),
|
CommandResult::Crash(
|
||||||
|
format!(
|
||||||
|
"Memory leak detected, delta variables count: {}",
|
||||||
|
end_count - start_count
|
||||||
|
)
|
||||||
|
.to_string(),
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
match flow_result {
|
||||||
|
Some(result) => result,
|
||||||
|
None => CommandResult::Continue(flow_output),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue