@gw-tools/gw 0.12.20 → 0.12.22
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/install.js +27 -8
- package/package.json +1 -1
package/install.js
CHANGED
|
@@ -148,14 +148,16 @@ async function install() {
|
|
|
148
148
|
|
|
149
149
|
console.log('✓ Installation complete!');
|
|
150
150
|
|
|
151
|
-
//
|
|
151
|
+
// Try to install shell integration, but don't fail if it errors
|
|
152
152
|
console.log('\n⚙️ Setting up shell integration...');
|
|
153
|
-
|
|
153
|
+
try {
|
|
154
|
+
await installShellIntegration(binaryPath);
|
|
155
|
+
} catch (error) {
|
|
156
|
+
console.log(' Shell integration setup encountered an issue.');
|
|
157
|
+
console.log(' You can install it manually later with: gw install-shell');
|
|
158
|
+
}
|
|
154
159
|
|
|
155
160
|
console.log('\nRun "gw --help" to get started.');
|
|
156
|
-
console.log(
|
|
157
|
-
'Tip: Restart your terminal or run "source ~/.zshrc" (or ~/.bashrc) to use "gw cd"',
|
|
158
|
-
);
|
|
159
161
|
} catch (error) {
|
|
160
162
|
console.error('\n✗ Installation failed:', error.message);
|
|
161
163
|
console.error('\nYou can manually download the binary from:');
|
|
@@ -175,9 +177,26 @@ async function installShellIntegration(binaryPath, retries = 3) {
|
|
|
175
177
|
const { spawn } = require('child_process');
|
|
176
178
|
|
|
177
179
|
return new Promise((resolve) => {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
180
|
+
let child;
|
|
181
|
+
|
|
182
|
+
try {
|
|
183
|
+
child = spawn(binaryPath, ['install-shell', '--quiet'], {
|
|
184
|
+
stdio: 'inherit',
|
|
185
|
+
});
|
|
186
|
+
} catch (err) {
|
|
187
|
+
// Catch synchronous spawn errors (e.g., ETXTBSY thrown immediately)
|
|
188
|
+
if (err.code === 'ETXTBSY' && retries > 0) {
|
|
189
|
+
setTimeout(() => {
|
|
190
|
+
installShellIntegration(binaryPath, retries - 1).then(resolve);
|
|
191
|
+
}, 200);
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
console.log(
|
|
195
|
+
' (Shell integration can be installed later with: gw install-shell)',
|
|
196
|
+
);
|
|
197
|
+
resolve();
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
181
200
|
|
|
182
201
|
child.on('close', (code) => {
|
|
183
202
|
if (code === 0) {
|