mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:18:11 +00:00
Shell: Resolve nonexistent string env variables to the empty string
We did this for lists, but not for strings.
This commit is contained in:
parent
d997b794fa
commit
d0112d76e9
1 changed files with 4 additions and 1 deletions
|
@ -3802,7 +3802,10 @@ ErrorOr<String> SimpleVariableValue::resolve_as_string(RefPtr<Shell> shell)
|
|||
return resolve_slices(shell, TRY(value->resolve_as_string(shell)), m_slices);
|
||||
|
||||
auto name = m_name.to_deprecated_string();
|
||||
char* env_value = getenv(name.characters());
|
||||
char const* env_value = getenv(name.characters());
|
||||
if (!env_value)
|
||||
env_value = "";
|
||||
|
||||
return resolve_slices(shell, TRY(String::from_utf8(StringView { env_value, strlen(env_value) })), m_slices);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue