auto-save 2026-04-19 21:39 (+1, ~2)
This commit is contained in:
@@ -84,7 +84,7 @@ export const incus = {
|
||||
}
|
||||
},
|
||||
|
||||
// user=0 root, user=1000 sandbox
|
||||
// user=0 root, user=1000 sandbox (defaults to sandbox venv + $HOME set for consistent Python env)
|
||||
exec: async (
|
||||
name: string,
|
||||
cmd: string[],
|
||||
@@ -93,6 +93,19 @@ export const incus = {
|
||||
const args = ['exec', name, ...projArgs];
|
||||
if (opts.user !== undefined) args.push('--user', String(opts.user));
|
||||
if (opts.cwd) args.push('--cwd', opts.cwd);
|
||||
// For sandbox user, bake in venv + HOME so `uv pip install xxx` (no --system) just works
|
||||
if (opts.user === 1000) {
|
||||
args.push(
|
||||
'--env',
|
||||
'VIRTUAL_ENV=/home/sandbox/.venv',
|
||||
'--env',
|
||||
'PATH=/home/sandbox/.venv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
|
||||
'--env',
|
||||
'HOME=/home/sandbox',
|
||||
'--env',
|
||||
'LANG=zh_CN.UTF-8',
|
||||
);
|
||||
}
|
||||
args.push('--');
|
||||
args.push(...cmd);
|
||||
const proc = Bun.spawn(['incus', ...args], {
|
||||
|
||||
Reference in New Issue
Block a user