Skip to content

[Shell] Error when opening shell via shortcut #3280

Closed

Description

@canac

Extension – Shell

Author: @KELiON

Description

When opening the shell command via a keyboard shortcut, an error always happens.

Error:

TypeError: Cannot read properties of undefined (reading 'command')

Un:index.js:79:50

---
76:     do script "${e.replaceAll('"','\\"')}"
77:     activate
78:   end tell
79:   `;ae(t)};function Un(e){let[t,n]=(0,I.useState)(""),[r,o]=(0,I.useState)(),[i,s]=Le("recently-used",[]),a=Fn.default.existsSync("/Applications/iTerm.app"),c=m=>{s(f=>f.find(S=>S===m)?f:[m,...f].slice(0,10))};(0,I.useEffect)(()=>{o([...new Set(Ve().reverse())])},[o]);let u=(0,d.getPreferenceValues)();if(e.arguments.command.length>0)return u.arguments_terminal?(c(e.arguments.command),(0,d.showHUD)("Ran command in iTerm/Terminal"),(0,d.popToRoot)(),(0,d.closeMainWindow)(),a?Bn(e.arguments.command):Mn(e.arguments.command)):_jsx(kn,{cmd:e.arguments.command});let p=[];return t&&p.push({category:"New command",items:[t]}),i.length>0&&p.push({category:"Raycast History",items:i.filter(m=>m.includes(t)).slice(0,50)}),r!==void 0&&r.length>0&&p.push({category:"Bash History",items:r.filter(m=>m.includes(t)).slice(0,50)}),_jsx(d.List,{isLoading:r===void 0,enableFiltering:!1,onSearchTextChange:n,navigationTitle:"Shell command",searchBarPlaceholder:"Enter shell-command"},p.map(m=>_jsx(d.List.Section,{title:m.category,key:m.category},m.items.map((f,S)=>_jsx(d.List.Item,{icon:d.Icon.Terminal,title:f,key:S,actions:_jsx(d.ActionPanel,null,_jsx(d.Action.Push,{title:"Execute",icon:d.Icon.List,onPush:()=>c(f),target:_jsx(kn,{cmd:f})}),a?_jsx(d.Action,{title:"Execute in iTerm.app",icon:d.Icon.Window,onAction:()=>{(0,d.closeMainWindow)(),(0,d.popToRoot)(),c(f),Bn(f)}}):null,_jsx(d.Action,{title:"Execute in Terminal.app",icon:d.Icon.Window,onAction:()=>{(0,d.closeMainWindow)(),(0,d.popToRoot)(),c(f),Mn(f)}}),_jsx(d.Action.CopyToClipboard,{title:"Copy to Clipboard",content:f,onCopy:()=>{c(f)}}))})))))}module.exports=Qn(ri);0&&(module.exports={});
80: 
---

jt:index.js:5:2490
ray-navigation-stack
Nr:index.js:5:2088
Suspense
Ht:index.js:4:3437
ray-root
Wi:index.js:5:3006

Steps To Reproduce

  1. Assign "Execute Shell Command" to a keyboard extension (Cmd+Option+T in my case).
  2. Type that keyboard extension.

The current behavior

The shell command opens to an error page. It works fine with opening Raycast, typing "Shell", and executing from the command list. It only errors when running the shell command via a shortcut.

The expected behavior

The shell command should not error.

Raycast version

Version: 1.41.1

Activity

  1. added
    bug
    extension
    on Oct 20, 2022
  2. added
    status: fixed in next release
    on Oct 24, 2022
  3. added a commit that references this issue on Sep 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugextensionstatus: fixed in next release

    Type

    No type

    Fields

    Priority

    None yet

    Severity

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions