fix: admin/home failing on some Windows machines

Massimo Melina committed May 27, 2023 at 14:43 UTC fb005aa7dfa494e74bf1dcd563eb7a423f9e3291
1 file changed +7 -2
src/adminApis.ts
+7 -2
@@ -181,8 +181,13 @@ export function ctxAdminAccess(ctx: Koa.Context) {
181
182 const frpDebounced = debounceAsync(async () => {
183 if (!IS_WINDOWS) return false
184 - const { stdout } = await promisify(execFile)('tasklist', ['/fi','imagename eq frpc.exe','/nh'])
185 - return stdout.includes('frpc')
184 + try { // guy with win11 reported missing tasklist, so don't take it for granted
185 + const { stdout } = await promisify(execFile)('tasklist', ['/fi','imagename eq frpc.exe','/nh'])
186 + return stdout.includes('frpc')
187 + }
188 + catch {
189 + return false
190 + }
191 })
192
193 export function anyAccountCanLoginAdmin() {