@officebeats/matrix-iptv-cli 4.0.17 → 4.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bin/cli.js +20 -5
  2. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -121,16 +121,31 @@ async function performUpdate() {
121
121
  if (os.platform() === "win32") {
122
122
  const batchScript = `
123
123
  @echo off
124
- timeout /t 2 /nobreak > nul
124
+ timeout /t 3 /nobreak > nul
125
125
  start "" "${binaryPath}" %*
126
126
  del "%~f0"
127
127
  `;
128
128
  const batchPath = path.join(os.tmpdir(), "matrix-relaunch.bat");
129
129
  fs.writeFileSync(batchPath, batchScript);
130
- spawn("cmd.exe", ["/c", batchPath, ...process.argv.slice(2)], {
131
- detached: true,
132
- stdio: "ignore",
133
- }).unref();
130
+
131
+ // Brief delay to let AV scanners release locks on newly written files
132
+ await new Promise((r) => setTimeout(r, 500));
133
+
134
+ let spawnAttempts = 0;
135
+ const maxSpawnAttempts = 5;
136
+ while (spawnAttempts < maxSpawnAttempts) {
137
+ try {
138
+ spawn("cmd.exe", ["/c", batchPath, ...process.argv.slice(2)], {
139
+ detached: true,
140
+ stdio: "ignore",
141
+ }).unref();
142
+ break;
143
+ } catch (spawnErr) {
144
+ spawnAttempts++;
145
+ if (spawnAttempts >= maxSpawnAttempts) throw spawnErr;
146
+ await new Promise((r) => setTimeout(r, 1000));
147
+ }
148
+ }
134
149
  process.exit(0);
135
150
  }
136
151
  } catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@officebeats/matrix-iptv-cli",
3
- "version": "4.0.17",
3
+ "version": "4.0.18",
4
4
  "description": "The premium Terminal IPTV Decoder",
5
5
  "main": "index.js",
6
6
  "bin": {