Compare commits
No commits in common. "24ebdf4f5aaea998a8cc6db7c078210731c1c26b" and "8c1a01ba7763578696003dc1a598158a96b48613" have entirely different histories.
24ebdf4f5a
...
8c1a01ba77
|
|
@ -9,7 +9,7 @@ const DEBUG = !!process.env.DEBUG
|
|||
const CONTAINER_NAME = "sandlot"
|
||||
const USER = "ubuntu"
|
||||
const CLAUDE_BIN = `/home/${USER}/.local/bin/claude`
|
||||
const CONTAINER_PATH = `/sandlot/bin:/sandlot/.cargo/bin:/sandlot/.go/bin:/sandlot/.gopath/bin:/home/${USER}/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin`
|
||||
const CONTAINER_PATH = `/sandlot/.cargo/bin:/sandlot/.go/bin:/sandlot/.gopath/bin:/home/${USER}/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin`
|
||||
const CONTAINER_ENV = {
|
||||
RUSTUP_HOME: "/sandlot/.rustup",
|
||||
CARGO_HOME: "/sandlot/.cargo",
|
||||
|
|
@ -80,8 +80,8 @@ async function createContainer(home: string): Promise<void> {
|
|||
/** Install base system packages (as root). */
|
||||
async function installPackages(cached: boolean): Promise<void> {
|
||||
const packages = cached
|
||||
? "curl git fish build-essential"
|
||||
: "curl git fish unzip build-essential"
|
||||
? "curl git fish make"
|
||||
: "curl git fish unzip make"
|
||||
await run(
|
||||
$`container exec ${CONTAINER_NAME} bash -c ${`apt update && apt install -y ${packages}`}`,
|
||||
"Package installation")
|
||||
|
|
@ -370,7 +370,7 @@ export async function neofetch(): Promise<void> {
|
|||
/** Run a bash command in the container at the given workdir, capturing output. */
|
||||
export async function exec(workdir: string, command: string): Promise<{ exitCode: number; stdout: string; stderr: string }> {
|
||||
const envExports = Object.entries(CONTAINER_ENV).map(([k, v]) => `export ${k}=${v}`).join("; ")
|
||||
const result = await $`container exec --user ${USER} --workdir ${containerPath(workdir)} ${CONTAINER_NAME} bash -c ${`export PATH=${CONTAINER_PATH}; ${envExports}; ` + command}`.nothrow().quiet()
|
||||
const result = await $`container exec --user ${USER} --workdir ${containerPath(workdir)} ${CONTAINER_NAME} bash -c ${`export PATH=$HOME/.local/bin:$PATH; ${envExports}; ` + command}`.nothrow().quiet()
|
||||
return {
|
||||
exitCode: result.exitCode,
|
||||
stdout: result.stdout.toString().trim(),
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user