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
|
||||
|
||||
* Alias based command implementations are not checked for variable leaks.
|
||||
* New get_home_dir command.
|
||||
* New array_join command.
|
||||
* The read_properties command now support **--prefix** flag.
|
||||
|
|
|
@ -90,6 +90,8 @@ impl Command for AliasCommand {
|
|||
if arguments.len() < self.arguments_amount {
|
||||
CommandResult::Error("Invalid arguments provided.".to_string())
|
||||
} else {
|
||||
let start_count = variables.len();
|
||||
|
||||
// define script arguments
|
||||
let mut handle_option = None;
|
||||
if !arguments.is_empty() {
|
||||
|
@ -198,6 +200,16 @@ impl Command for AliasCommand {
|
|||
}
|
||||
clear(&self.scope_name, variables);
|
||||
|
||||
let end_count = variables.len();
|
||||
if start_count != end_count {
|
||||
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),
|
||||
|
@ -205,6 +217,7 @@ impl Command for AliasCommand {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn create_alias_command(
|
||||
name: String,
|
||||
|
|
Loading…
Reference in a new issue