Skip to content

Commit fe3304c

Browse files
bcouetilCopilot
andauthored
fix(windows): skip id -u on Windows to avoid confusing startup error (#1824)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent e590d11 commit fe3304c

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

src/git-data.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,12 +172,19 @@ export class GitData {
172172
});
173173
promises.push(gitEmailPromise);
174174

175-
const osUidPromise = Utils.spawn(["id", "-u"], cwd).then(({stdout}) => {
176-
this.user.GITLAB_USER_ID = stdout.trimEnd();
177-
}).catch((e) => {
178-
writeStreams.stderr(chalk`{yellow Using fallback linux user id}\n`);
179-
writeStreams.stderr(chalk`{yellow ${e.message}\n}`);
180-
});
175+
const osUidPromise = (async () => {
176+
if (process.platform === "win32") {
177+
// GITLAB_USER_ID is a Unix UID concept; keep default on Windows
178+
return;
179+
}
180+
try {
181+
const {stdout} = await Utils.spawn(["id", "-u"], cwd);
182+
this.user.GITLAB_USER_ID = stdout.trimEnd();
183+
} catch (e: any) {
184+
writeStreams.stderr(chalk`{yellow Using fallback linux user id}\n`);
185+
writeStreams.stderr(chalk`{yellow ${e.message}\n}`);
186+
}
187+
})();
181188
promises.push(osUidPromise);
182189

183190
await Promise.all(promises);

0 commit comments

Comments
 (0)