1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:27:46 +00:00

Userland: Fail Core::find_executable_in_path on empty inputs

Before this patch, `which ""` or `type ""` would say that the empty
string is `/usr/local/bin/`.

Convert callers to consistently call is_empty() on the returned string
while we're at it, to support eventually removing the is_null() String
state in the future.
This commit is contained in:
Andrew Kaster 2022-01-03 23:43:16 -07:00 committed by Brian Gianforcaro
parent 7f9bd34d07
commit 170a7e263c
3 changed files with 5 additions and 2 deletions

View file

@ -227,7 +227,7 @@ int Shell::builtin_type(int argc, const char** argv)
// check if its an executable in PATH
auto fullpath = Core::find_executable_in_path(command);
if (!fullpath.is_null()) {
if (!fullpath.is_empty()) {
printf("%s is %s\n", command, escape_token(fullpath).characters());
continue;
}