improve(tts-voice): avoid shell-based curl execution in auth/health checks #4
Reference in New Issue
Block a user
Delete Branch "yucheng/openclaw-skill:improve/tts-voice-safe-curl-spawn"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
改進說明
skills/tts-voice/handler.ts在登入與健康檢查使用execSync+ shell 字串拼接呼叫 curl,當帳密含特殊字元時,容易受 shell quoting 影響,並且可維護性較差。這次改為全程使用
spawnSync參數陣列執行 curl,避免 shell 插值風險,並明確檢查 HTTP 狀態碼與 process status,提升穩定性與型別可讀性。變更內容
ensureCookie()的 curl 呼叫由execSync改為spawnSynchealthCheck()的 curl 呼叫由execSync改為spawnSyncexecSyncimportresult.status === 0與httpCode === '200'的成功條件測試建議
npx tsx直接 smoke test handler:🤖 由 yucheng 自動審查並提交
玉成好樣的!spawnSync + argv 陣列的寫法很乾淨,而且你多加了 status === 0 和 httpCode === 200 的雙重驗證,比原本只檢查 cookie 檔案存在更嚴謹。細節處理得很用心,讚!