Skip to content

Commit 9fd3edc

Browse files
git running
1 parent a0f76f9 commit 9fd3edc

File tree

3 files changed

+17
-25
lines changed

3 files changed

+17
-25
lines changed

src/Sandbox.ts

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,9 @@ export class Sandbox {
150150
}
151151

152152
return customSession.git
153-
? { GIT_CONFIG: "$HOME/private/.gitconfig", ...customSession.env }
153+
? {
154+
...customSession.env,
155+
}
154156
: customSession.env;
155157
}
156158

@@ -194,33 +196,23 @@ export class Sandbox {
194196

195197
if (customSession?.git) {
196198
try {
197-
await session.fs.mkdir("/root/private");
199+
await session.commands.run("mkdir -p $HOME/private");
198200
} catch {}
199201

200202
await Promise.all([
201-
session.fs.writeTextFile(
202-
"/root/private/.gitcredentials",
203-
`https://${customSession.git.username || "x-access-token"}:${
203+
session.commands.run(
204+
`echo "https://${customSession.git.username || "x-access-token"}:${
204205
customSession.git.accessToken
205-
}@${customSession.git.provider}\n`,
206-
{
207-
create: true,
208-
overwrite: true,
209-
}
206+
}@${customSession.git.provider}" > $HOME/private/.gitcredentials`
210207
),
211-
session.fs.writeTextFile(
212-
"/root/private/.gitconfig",
213-
`[user]
208+
session.commands.run(
209+
`echo "[user]
214210
name = ${customSession.git.name || customSession.id}
215211
email = ${customSession.git.email}
216212
[init]
217213
defaultBranch = main
218214
[credential]
219-
helper = store --file ~/private/.gitcredentials`,
220-
{
221-
create: true,
222-
overwrite: true,
223-
}
215+
helper = store --file ~/private/.gitcredentials" > $HOME/.gitconfig`
224216
),
225217
]);
226218
}

src/Session/commands.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ export class Commands {
6262
commandWithEnv = `cd ${opts.cwd} && ${commandWithEnv}`;
6363
}
6464

65-
console.log("WTF", commandWithEnv);
66-
6765
const shell = await this.agentClient.shells.create(
6866
this.agentClient.workspacePath,
6967
opts?.dimensions ?? DEFAULT_SHELL_SIZE,

src/bin/commands/build.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -359,10 +359,12 @@ export const buildCommand: yargs.CommandModule<
359359
spinner.start(
360360
updateSpinnerMessage(
361361
index,
362-
"Failed, please manually verify at https://codesandbox.io/s/" +
363-
sandboxId +
364-
" - " +
365-
String(error),
362+
argv.ci
363+
? String(error)
364+
: "Failed, please manually verify at https://codesandbox.io/s/" +
365+
sandboxId +
366+
" - " +
367+
String(error),
366368
sandboxId
367369
)
368370
);
@@ -378,7 +380,7 @@ export const buildCommand: yargs.CommandModule<
378380
(_, index) => results[index].status === "rejected"
379381
);
380382

381-
if (failedSandboxes.length > 0) {
383+
if (!argv.ci && failedSandboxes.length > 0) {
382384
spinner.info(`\n${spinnerMessages.join("\n")}`);
383385

384386
await waitForEnter(

0 commit comments

Comments
 (0)