mirror of
https://github.com/garrytan/gstack.git
synced 2026-05-05 05:05:08 +02:00
fix: settings-hook remove exits 1 when nothing to remove
gstack-settings-hook remove was exiting 0 when settings.json didn't exist, causing gstack-uninstall to report "SessionStart hook" as removed on clean systems where nothing was installed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -54,7 +54,7 @@ case "$ACTION" in
|
||||
" 2>/dev/null
|
||||
;;
|
||||
remove)
|
||||
[ -f "$SETTINGS_FILE" ] || exit 0
|
||||
[ -f "$SETTINGS_FILE" ] || exit 1
|
||||
GSTACK_SETTINGS_PATH="$SETTINGS_FILE" bun -e "
|
||||
const fs = require('fs');
|
||||
const settingsPath = process.env.GSTACK_SETTINGS_PATH;
|
||||
|
||||
@@ -85,11 +85,11 @@ describe('gstack-settings-hook', () => {
|
||||
expect(settings.hooks).toBeUndefined();
|
||||
});
|
||||
|
||||
test('remove is safe when settings.json does not exist', () => {
|
||||
test('remove exits 1 when settings.json does not exist', () => {
|
||||
const result = run(`${SETTINGS_HOOK} remove /path/to/gstack-session-update`, {
|
||||
env: { GSTACK_SETTINGS_FILE: settingsFile },
|
||||
});
|
||||
expect(result.exitCode).toBe(0);
|
||||
expect(result.exitCode).toBe(1);
|
||||
});
|
||||
|
||||
test('remove preserves other hooks', () => {
|
||||
|
||||
Reference in New Issue
Block a user