sshifu 0.7.8-test.7 → 0.7.8-test.9
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/package.json +1 -1
- package/scripts/install.js +36 -13
package/package.json
CHANGED
package/scripts/install.js
CHANGED
|
@@ -95,19 +95,42 @@ async function main() {
|
|
|
95
95
|
const archiveBinName = `${PACKAGE_NAME}-${platform}${isWindows ? '.exe' : ''}`;
|
|
96
96
|
const extractedPath = path.join(binDir, archiveBinName);
|
|
97
97
|
if (isWindows) {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
98
|
+
// Retry extraction to handle file lock issues on Windows
|
|
99
|
+
const maxRetries = 5;
|
|
100
|
+
let lastErr;
|
|
101
|
+
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
102
|
+
try {
|
|
103
|
+
// Small delay before each attempt to ensure file handle is released
|
|
104
|
+
if (attempt > 1) {
|
|
105
|
+
console.log(`[sshifu] Retry attempt ${attempt}/${maxRetries}...`);
|
|
106
|
+
await new Promise(resolve => setTimeout(resolve, attempt * 500));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Use PowerShell with explicit error action and output redirection
|
|
110
|
+
const psCommand = `Expand-Archive -Path '${archivePath.replace(/'/g, "''")}' -DestinationPath '${binDir.replace(/'/g, "''")}' -Force -ErrorAction Stop`;
|
|
111
|
+
console.log(`[sshifu] Running: ${psCommand}`);
|
|
112
|
+
execSync(`powershell -Command "${psCommand}"`, { stdio: ['ignore', 'pipe', 'pipe'] });
|
|
113
|
+
console.log(`[sshifu] Extraction completed, checking files...`);
|
|
114
|
+
const afterExtract = fs.readdirSync(binDir);
|
|
115
|
+
console.log(`[sshifu] Files after extraction: ${afterExtract.join(', ')}`);
|
|
116
|
+
lastErr = null;
|
|
117
|
+
break;
|
|
118
|
+
} catch (extractErr) {
|
|
119
|
+
lastErr = extractErr;
|
|
120
|
+
console.error(`[sshifu] Extraction attempt ${attempt} failed: ${extractErr.message}`);
|
|
121
|
+
if (extractErr.message.includes('being used by another process')) {
|
|
122
|
+
console.log(`[sshifu] File locked, will retry...`);
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
// Non-retryable error
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
if (lastErr) {
|
|
130
|
+
console.error(`[sshifu] All extraction attempts failed`);
|
|
131
|
+
console.error(`[sshifu] stderr: ${lastErr.stderr?.toString() || 'N/A'}`);
|
|
132
|
+
console.error(`[sshifu] stdout: ${lastErr.stdout?.toString() || 'N/A'}`);
|
|
133
|
+
throw lastErr;
|
|
111
134
|
}
|
|
112
135
|
} else {
|
|
113
136
|
execSync(`tar -xzf "${archivePath}" -C "${binDir}"`, { stdio: 'ignore' });
|