mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 05:51:24 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -29,16 +29,22 @@ function fallbackHostName() {
|
||||
}
|
||||
|
||||
export async function getMachineDisplayName(): Promise<string> {
|
||||
if (cachedPromise) return cachedPromise;
|
||||
if (cachedPromise) {
|
||||
return cachedPromise;
|
||||
}
|
||||
cachedPromise = (async () => {
|
||||
if (process.env.VITEST || process.env.NODE_ENV === "test") {
|
||||
return fallbackHostName();
|
||||
}
|
||||
if (process.platform === "darwin") {
|
||||
const computerName = await tryScutil("ComputerName");
|
||||
if (computerName) return computerName;
|
||||
if (computerName) {
|
||||
return computerName;
|
||||
}
|
||||
const localHostName = await tryScutil("LocalHostName");
|
||||
if (localHostName) return localHostName;
|
||||
if (localHostName) {
|
||||
return localHostName;
|
||||
}
|
||||
}
|
||||
return fallbackHostName();
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user