private void App_PhaseEvent(object sender, PhaseEventArgs e) { if (!File.Exists(_scriptHook)) { return; } var ret = ShellHelper.Execute(_scriptHook, true, new Dictionary <string, string> { { "CV4PVE_AUTOSNAP_PHASE", e.Phase }, { "CV4PVE_AUTOSNAP_VMID", e.VM?.Id + "" }, { "CV4PVE_AUTOSNAP_VMNAME", e.VM?.Name }, { "CV4PVE_AUTOSNAP_VMTYPE", e.VM?.Type + "" }, { "CV4PVE_AUTOSNAP_LABEL", e.Label }, { "CV4PVE_AUTOSNAP_KEEP", e.Keep + "" }, { "CV4PVE_AUTOSNAP_SNAP_NAME", e.SnapName }, { "CV4PVE_AUTOSNAP_VMSTATE", e.State ? "1" :"0" }, { "CV4PVE_AUTOSNAP_DEBUG", _debug ? "1" :"0" }, { "CV4PVE_AUTOSNAP_DRY_RUN", _dryRun ? "1" :"0" }, }, _stdOut, _dryRun, _debug); if (ret.ExitCode != 0) { _stdOut.WriteLine($"Script return code: {ret.ExitCode}"); } if (!string.IsNullOrWhiteSpace(ret.StandardOutput)) { _stdOut.Write(ret.StandardOutput); } }