ricklamers / shell-ai

LangChain powered shell command generator and runner CLI
MIT License
1.02k stars 62 forks source link

Error : returned non-zero exit status 1 #9

Closed blueman007 closed 1 year ago

blueman007 commented 1 year ago

When I try a simple ls command, I got this error message:

(base) ➜  ~ shai list images ls
? Select a command: ls *.jpg *.png *.jpeg *.gif *.bmp
ls: *.bmp: No such file or directory
ls: *.gif: No such file or directory
ls: *.jpeg: No such file or directory
ls: *.png: No such file or directory
710097.jpg
Error executing command: Command 'ls *.jpg *.png *.jpeg *.gif *.bmp' returned non-zero exit status 1.

It seems that if part of the command fail, I end uo with this error message instead of the usual empty string. Any idea why ?

ricklamers commented 1 year ago

It's an implementation choice of acting on the return exit code of command: https://github.com/ricklamers/shell-ai/blob/6815efda0c1f490a32e06a773268254fd78f688b/shell_ai/main.py#L107

I thought it was pretty unix-y but agree in this example it's a bit annoying perhaps. I'll probably leave it like this though.