Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions packages/cli/src/commands/cli/fix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
import { OutputError } from "../../lib/errors.js";
import { formatFixResult } from "../../lib/formatters/human.js";
import { CommandOutput } from "../../lib/formatters/output.js";
import { logger } from "../../lib/logger.js";
import { getRealUsername } from "../../lib/utils.js";

type FixFlags = {
Expand Down Expand Up @@ -251,16 +252,18 @@ async function checkOwnership(
* Uses `execFileSync` (not `execSync`) so the username is passed as a
* separate argument — the shell never interpolates it, preventing injection.
*/
const log = logger.withTag("cli.fix");

function resolveUid(username: string): number | null {
// biome-ignore lint/plugin: grandfathered silent catch — see #1531; drain by adding log.debug()/log.warn() or re-throwing.
try {
const result = execFileSync("id", ["-u", "--", username], {
encoding: "utf-8",
stdio: ["pipe", "pipe", "ignore"],
});
const uid = Number(result.trim());
return Number.isNaN(uid) ? null : uid;
} catch {
} catch (error) {
log.debug(`Failed to resolve UID for user "${username}"`, error);
return null;
}
}
Expand Down
Loading