From 557f3e27b6b8a2e729ffa0c293179720521fdd74 Mon Sep 17 00:00:00 2001 From: Luca Saccarola Date: Sun, 6 Aug 2023 13:07:44 +0200 Subject: [PATCH] fix: remove run key before saving the state --- lua/paq.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lua/paq.lua b/lua/paq.lua index c069ab2..a5a88e2 100644 --- a/lua/paq.lua +++ b/lua/paq.lua @@ -91,9 +91,15 @@ local function lock_load() end local function state_write() + -- remove run key since can have a function in it, and + -- json.encode doesn't support functions + local pkgs = vim.deepcopy(packages) + for p, _ in pairs(pkgs) do + pkgs[p].run = nil + end local file = uv.fs_open(lockfile, "w", 438) if file then - local ok, result = pcall(vim.json.encode, packages) + local ok, result = pcall(vim.json.encode, pkgs) if not ok then error(result) end