Skip to content

Commit d5b4e9d

Browse files
committed
fix(create): avoid logging during clone spinner
1 parent 69b6db9 commit d5b4e9d

2 files changed

Lines changed: 5 additions & 10 deletions

File tree

modules/clone/index.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,19 +144,17 @@ export const run = async ({ config, args, cd }: ModuleRunOptions) => {
144144

145145
if (ssh && !isKnownHost(org)) {
146146
report.warn(`using ssh but ${org} is not in the known hosts.`);
147+
report.command(`ssh-keyscan ${org} >> ~/.ssh/known_hosts`);
147148
await spinner(`adding ${org} to known hosts`, async () => {
148-
report.command(`ssh-keyscan ${org} >> ~/.ssh/known_hosts`);
149149
await $`ssh-keyscan ${org} >> ~/.ssh/known_hosts`;
150150
});
151151
}
152152

153+
const forwardedArgs = args.slice(1);
154+
report.command(`git clone ${forwardedArgs.join(" ")} ${remote} ${clonePath}`);
153155
const result = await spinner(
154156
`cloning ${user}/${repo} into ${clonePath}`,
155157
async () => {
156-
const forwardedArgs = args.slice(1);
157-
report.command(
158-
`git clone ${forwardedArgs.join(" ")} ${remote} ${clonePath}`,
159-
);
160158
return await $`git clone ${forwardedArgs} ${remote} ${clonePath}`
161159
.nothrow();
162160
},

utils/spinner.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,8 @@ export const spinner = async <T>(
77
const spinner = report.activity();
88
spinner.tick(title);
99
try {
10-
const result = await fn();
10+
return await fn();
11+
} finally {
1112
spinner.end();
12-
return result;
13-
} catch (err) {
14-
spinner.end();
15-
throw err;
1613
}
1714
};

0 commit comments

Comments
 (0)