Skip to content

Fix PID handling and improve fish shell compatibility#1

Merged
zigai merged 3 commits into
zigai:masterfrom
gymynnym:feat/init-fish
Mar 26, 2026
Merged

Fix PID handling and improve fish shell compatibility#1
zigai merged 3 commits into
zigai:masterfrom
gymynnym:feat/init-fish

Conversation

@gymynnym

Copy link
Copy Markdown
Contributor

Problem 1: Error when initialization

- (line 19): $$ is not the pid. In fish, please use $fish_pid.
            set -g __zgod_session_id (echo "$$-"(date +%s))
                                             ^

Fish does not support $$ for PID, which causes an initialization error. This is resolved by using $fish_pid.

Problem 2: Warning when exit

There are still jobs active:

   PID  Command
 78083  zgod record \
        --ts "$start_ms" \
        --duration "$CMD_DURATION" \
        --exit-code "$exit_code" \
        --command "$__zgod_command" \
        --directory "$PWD" \
        --session "$__zgod_session_id" &

A second attempt to exit will terminate them.
Use 'disown PID' to remove jobs from the list without terminating them.

The background job remains attached to the shell and triggers a warning on exit. This is resolved by adding disown after execution.

Additional Fix

  • Replaced command -v with type -q for proper Fish compatibility.
  • Updated README to use conf.d/zgod.fish, as config.fish is not recommended for initialization scripts

@zigai
zigai merged commit 2777eea into zigai:master Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants