fix(codex): prevent sound hook timeouts
This commit is contained in:
@@ -1138,7 +1138,7 @@ _setup_codex_sound_hooks() {
|
|||||||
paplay /usr/share/sounds/freedesktop/stereo/complete.oga 2>/dev/null ||
|
paplay /usr/share/sounds/freedesktop/stereo/complete.oga 2>/dev/null ||
|
||||||
pw-play --volume=1 /usr/share/sounds/freedesktop/stereo/complete.oga 2>/dev/null ||
|
pw-play --volume=1 /usr/share/sounds/freedesktop/stereo/complete.oga 2>/dev/null ||
|
||||||
aplay /usr/share/sounds/freedesktop/stereo/complete.oga 2>/dev/null
|
aplay /usr/share/sounds/freedesktop/stereo/complete.oga 2>/dev/null
|
||||||
) &
|
) </dev/null >/dev/null 2>&1 &
|
||||||
SOUNDEOF
|
SOUNDEOF
|
||||||
|
|
||||||
cat > "$hooks_dir/ai-setup-sound-on-auto-compact.sh" <<'SOUNDEOF'
|
cat > "$hooks_dir/ai-setup-sound-on-auto-compact.sh" <<'SOUNDEOF'
|
||||||
@@ -1149,7 +1149,7 @@ SOUNDEOF
|
|||||||
paplay /usr/share/sounds/freedesktop/stereo/alarm-clock-elapsed.oga 2>/dev/null ||
|
paplay /usr/share/sounds/freedesktop/stereo/alarm-clock-elapsed.oga 2>/dev/null ||
|
||||||
pw-play --volume=1 /usr/share/sounds/freedesktop/stereo/alarm-clock-elapsed.oga 2>/dev/null ||
|
pw-play --volume=1 /usr/share/sounds/freedesktop/stereo/alarm-clock-elapsed.oga 2>/dev/null ||
|
||||||
aplay /usr/share/sounds/freedesktop/stereo/alarm-clock-elapsed.oga 2>/dev/null
|
aplay /usr/share/sounds/freedesktop/stereo/alarm-clock-elapsed.oga 2>/dev/null
|
||||||
) &
|
) </dev/null >/dev/null 2>&1 &
|
||||||
SOUNDEOF
|
SOUNDEOF
|
||||||
chmod +x "$hooks_dir/ai-setup-sound-on-stop.sh" "$hooks_dir/ai-setup-sound-on-auto-compact.sh"
|
chmod +x "$hooks_dir/ai-setup-sound-on-stop.sh" "$hooks_dir/ai-setup-sound-on-auto-compact.sh"
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ GEMINI_SECTION=$(awk '/^cat > "\$BIN_DIR\/ai-gemini"/,/^GEMINIEOF/' "$SCRIPT")
|
|||||||
OPENCODE_SECTION=$(awk '/^cat > "\$BIN_DIR\/ai-opencode"/,/^OPENCODEEOF/' "$SCRIPT")
|
OPENCODE_SECTION=$(awk '/^cat > "\$BIN_DIR\/ai-opencode"/,/^OPENCODEEOF/' "$SCRIPT")
|
||||||
CURSOR_SECTION=$(awk '/^cat > "\$BIN_DIR\/ai-cursor"/,/^CURSOREOF/' "$SCRIPT")
|
CURSOR_SECTION=$(awk '/^cat > "\$BIN_DIR\/ai-cursor"/,/^CURSOREOF/' "$SCRIPT")
|
||||||
HELPERS_SECTION=$(awk '/^cat > "\$HELPERS_FILE"/,/^HELPEREOF/' "$SCRIPT")
|
HELPERS_SECTION=$(awk '/^cat > "\$HELPERS_FILE"/,/^HELPEREOF/' "$SCRIPT")
|
||||||
|
CODEX_SOUND_HOOKS_SECTION=$(awk '/^_setup_codex_sound_hooks\(\)/,/^}/' "$SCRIPT")
|
||||||
|
|
||||||
# ── ai-gpt: auto-install codex ────────────────────────────────────────────
|
# ── ai-gpt: auto-install codex ────────────────────────────────────────────
|
||||||
test_gpt_autoinstall() {
|
test_gpt_autoinstall() {
|
||||||
@@ -146,6 +147,16 @@ test_native_rule_files_generated() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test_codex_sound_hooks_detach_stdio() {
|
||||||
|
local detached_count
|
||||||
|
detached_count=$(printf '%s\n' "$CODEX_SOUND_HOOKS_SECTION" | grep -Fc ') </dev/null >/dev/null 2>&1 &' || true)
|
||||||
|
if [ "$detached_count" -eq 2 ]; then
|
||||||
|
ok "codex hooks: background sound players detach standard streams"
|
||||||
|
else
|
||||||
|
fail "codex hooks: background sound players can keep hook pipes open"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# ── Fix 7: trap quotes $TMP correctly ────────────────────────────────────────
|
# ── Fix 7: trap quotes $TMP correctly ────────────────────────────────────────
|
||||||
test_fix7_trap_tmp() {
|
test_fix7_trap_tmp() {
|
||||||
if grep -q "trap 'rm -rf \"\$TMP\"' EXIT" "$SCRIPT"; then
|
if grep -q "trap 'rm -rf \"\$TMP\"' EXIT" "$SCRIPT"; then
|
||||||
@@ -289,6 +300,7 @@ test_gemini_native_launcher
|
|||||||
test_cursor_native_launcher
|
test_cursor_native_launcher
|
||||||
test_global_rules_include_quality_guidelines
|
test_global_rules_include_quality_guidelines
|
||||||
test_native_rule_files_generated
|
test_native_rule_files_generated
|
||||||
|
test_codex_sound_hooks_detach_stdio
|
||||||
test_fix7_trap_tmp
|
test_fix7_trap_tmp
|
||||||
test_android_cli_install_url
|
test_android_cli_install_url
|
||||||
test_android_init_called
|
test_android_init_called
|
||||||
|
|||||||
Reference in New Issue
Block a user