@officebeats/matrix-iptv-cli 4.0.2 → 4.0.5
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.
- package/bin/cli.js +25 -6
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -124,7 +124,7 @@ async function performUpdate() {
|
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
function launchApp() {
|
|
127
|
+
function launchApp(isUpdateRelaunch = false) {
|
|
128
128
|
if (!fs.existsSync(binaryPath)) {
|
|
129
129
|
console.error("\n❌ Matrix IPTV binary not found.");
|
|
130
130
|
console.log(
|
|
@@ -133,12 +133,27 @@ function launchApp() {
|
|
|
133
133
|
process.exit(1);
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
136
|
+
let child;
|
|
137
|
+
try {
|
|
138
|
+
child = spawn(binaryPath, process.argv.slice(2), {
|
|
139
|
+
stdio: "inherit",
|
|
140
|
+
windowsHide: false,
|
|
141
|
+
});
|
|
142
|
+
} catch (err) {
|
|
143
|
+
if (isUpdateRelaunch && (err.code === "EBUSY" || err.code === "EACCES")) {
|
|
144
|
+
console.log(`[*] Executable locked by OS. Retrying in 2 seconds...`);
|
|
145
|
+
setTimeout(() => launchApp(true), 2000);
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
throw err;
|
|
149
|
+
}
|
|
140
150
|
|
|
141
151
|
child.on("error", (err) => {
|
|
152
|
+
if (isUpdateRelaunch && (err.code === "EBUSY" || err.code === "EACCES")) {
|
|
153
|
+
console.log(`[*] Executable locked by OS. Retrying in 2 seconds...`);
|
|
154
|
+
setTimeout(() => launchApp(true), 2000);
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
142
157
|
console.error("Failed to start Matrix IPTV:", err);
|
|
143
158
|
process.exit(1);
|
|
144
159
|
});
|
|
@@ -147,7 +162,11 @@ function launchApp() {
|
|
|
147
162
|
if (code === 42) {
|
|
148
163
|
try {
|
|
149
164
|
await performUpdate();
|
|
150
|
-
|
|
165
|
+
// Add a small initial delay on Windows before even trying
|
|
166
|
+
if (os.platform() === 'win32') {
|
|
167
|
+
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
168
|
+
}
|
|
169
|
+
launchApp(true); // Relaunch
|
|
151
170
|
} catch (err) {
|
|
152
171
|
console.error(`\n❌ Update failed: ${err.message}`);
|
|
153
172
|
process.exit(1);
|