mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
Merge branch 'codex/chore/pw-session-home-fallback'
This commit is contained in:
+14
-2
@@ -45,8 +45,20 @@ EOF
|
||||
}
|
||||
|
||||
playwright_cli="${PLAYWRIGHT_CLI_BIN:-playwright-cli}"
|
||||
lock_root="${XDG_CACHE_HOME:-$HOME/.cache}/bitsocial"
|
||||
lock_dir="${PLAYWRIGHT_RESOURCE_LOCK_DIR:-$lock_root/playwright-session.lock}"
|
||||
|
||||
# Resolved in order so an explicit override never depends on HOME being set:
|
||||
# some sandboxes, CI runners, and test harnesses start without it.
|
||||
if [ -n "${PLAYWRIGHT_RESOURCE_LOCK_DIR:-}" ]; then
|
||||
lock_dir="$PLAYWRIGHT_RESOURCE_LOCK_DIR"
|
||||
elif [ -n "${XDG_CACHE_HOME:-}" ]; then
|
||||
lock_dir="$XDG_CACHE_HOME/bitsocial/playwright-session.lock"
|
||||
elif [ -n "${HOME:-}" ]; then
|
||||
lock_dir="$HOME/.cache/bitsocial/playwright-session.lock"
|
||||
else
|
||||
echo "pw-session: set HOME, XDG_CACHE_HOME, or PLAYWRIGHT_RESOURCE_LOCK_DIR so the lock has a home" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
owner_file="$lock_dir/owner"
|
||||
started_file="$lock_dir/started-at"
|
||||
workspace_file="$lock_dir/workspace"
|
||||
|
||||
@@ -47,8 +47,11 @@ let tempDir;
|
||||
const run = (...args) => {
|
||||
const result = spawnSync(scriptPath, args, {
|
||||
encoding: 'utf8',
|
||||
// PATH and HOME are named explicitly rather than relying on spreading
|
||||
// process.env, which vitest patches per environment.
|
||||
env: {
|
||||
...process.env,
|
||||
PATH: process.env.PATH,
|
||||
HOME: process.env.HOME,
|
||||
PLAYWRIGHT_RESOURCE_LOCK_DIR: path.join(tempDir, 'slot.lock'),
|
||||
PLAYWRIGHT_CLI_BIN: path.join(tempDir, 'fake-playwright-cli'),
|
||||
PW_SESSION_POLL_SECONDS: '1',
|
||||
|
||||
Reference in New Issue
Block a user