mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-08 01:57:31 +01:00
Handle slow and stale workspace startup
Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
1 parent
1dce216cb3
commit
ab8682d2aa
3 files changed
+178
-7
No files matched your search
@@ -404,14 +404,49 @@ if [[ -f "$worktree_cwd/package.json" && -f "$worktree_cwd/pnpm-lock.yaml" ]]; t
|
||||
done
|
||||
}
|
||||
|
||||
(
|
||||
cd "$worktree_cwd"
|
||||
pnpm install --frozen-lockfile
|
||||
) || {
|
||||
restore_moved_symlinks
|
||||
exit 1
|
||||
run_pnpm_install() {
|
||||
local stdout_path stderr_path
|
||||
stdout_path="$(mktemp)"
|
||||
stderr_path="$(mktemp)"
|
||||
|
||||
if (
|
||||
cd "$worktree_cwd"
|
||||
pnpm install "$@"
|
||||
) >"$stdout_path" 2>"$stderr_path"; then
|
||||
cat "$stdout_path"
|
||||
cat "$stderr_path" >&2
|
||||
rm -f "$stdout_path" "$stderr_path"
|
||||
return 0
|
||||
fi
|
||||
|
||||
local exit_code=$?
|
||||
cat "$stdout_path"
|
||||
cat "$stderr_path" >&2
|
||||
if grep -q "ERR_PNPM_OUTDATED_LOCKFILE" "$stdout_path" "$stderr_path"; then
|
||||
rm -f "$stdout_path" "$stderr_path"
|
||||
return 90
|
||||
fi
|
||||
|
||||
rm -f "$stdout_path" "$stderr_path"
|
||||
return "$exit_code"
|
||||
}
|
||||
|
||||
if run_pnpm_install --frozen-lockfile; then
|
||||
:
|
||||
else
|
||||
install_exit_code=$?
|
||||
if [[ "$install_exit_code" -eq 90 ]]; then
|
||||
echo "pnpm-lock.yaml is out of date in this execution workspace; retrying install without --frozen-lockfile." >&2
|
||||
run_pnpm_install --no-frozen-lockfile || {
|
||||
restore_moved_symlinks
|
||||
exit 1
|
||||
}
|
||||
else
|
||||
restore_moved_symlinks
|
||||
exit "$install_exit_code"
|
||||
fi
|
||||
fi
|
||||
|
||||
cleanup_moved_symlinks
|
||||
fi
|
||||
|
||||
|
||||
Reference in new issue
Block a user