You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
make the "External command failed" error more descriptive #8313
>_ let var = ("yes\nno"| to text | fzf | str trim);$var
yes
>_ let var = ("yes\no"| to text | fzf);$var
Error: nu::shell::external_command
× External command failed
╭─[entry #4:1:1]
1 │ let var = ("yes\no"| to text | fzf);$var
· ─┬─
· ╰── External command failed
╰────
help:
however, i find the error in itself not very descriptive 🤔
because, in the end, fzf does not fail at all here! 😮
Describe the solution you'd like
i'm not sure what the issue with fzf without str trim here is, so i do not know what the message should be 🤔
however, i'm pretty sure the fzf external command did NOT fail, so the error message should probably NOT be "External command failed" 😋
I figure the failure is because fzf is returning with some odd character. Maybe a newline or a \0 or a space. We could probably figure out what it's returning.
The \n is throwing things off. Having items in a list and stripping the \n with str trim
This seems to work better
[yes no] | to text | fzf | str trim | debug -r
String {
val: "no",
span: Span {
start: 198127,
end: 198135,
},
}
I think the reason that this is expected is it's hard to tell if and when we should strip the newline. Maybe I'm wrong and there is a good heuristic that we could use or that we're already using and it just being missed here somehow.
firstly "yes\no" shows up as o and yes because double quotes interprets \n as an escape.
woopsie, i forgot the "n", that's on me 😌
The \n is throwing things off.
yeah, probably
BTW - I agree, that 'external command failed' isn't super helpful considering what the problem is here.
if there is an "easy" change to be made, maybe it's on this error message?
=> something that looks odd to me is that, as you can see in the recording, fzf does not even launch when ommiting the str trim 🤔
it just hangs and i have to kill fzf to see the error...
Activity
fdncred commentedon Mar 4, 2023
I figure the failure is because
fzfis returning with some odd character. Maybe a newline or a \0 or a space. We could probably figure out what it's returning.fdncred commentedon Mar 4, 2023
ok, this is what I found
oandyesbecause double quotes interprets\nas an escape.fzfis returning like thisThe
\nis throwing things off. Having items in a list and stripping the\nwithstr trimThis seems to work better
I think the reason that this is expected is it's hard to tell if and when we should strip the newline. Maybe I'm wrong and there is a good heuristic that we could use or that we're already using and it just being missed here somehow.
fdncred commentedon Mar 4, 2023
BTW - I agree, that 'external command failed' isn't super helpful considering what the problem is here.
amtoine commentedon Mar 4, 2023
woopsie, i forgot the "n", that's on me 😌
yeah, probably
if there is an "easy" change to be made, maybe it's on this error message?
=> something that looks odd to me is that, as you can see in the recording,
fzfdoes not even launch when ommiting thestr trim🤔it just hangs and i have to kill
fzfto see the error...fdncred commentedon Mar 4, 2023
I don't have this issue on macos. it launches fine without str trim.
amtoine commentedon Mar 4, 2023
oooh 🤔
interesting
because, i might have been unclear but yeah the real strange thing is that
fzfdoes not show up at all 😱i can reproduce that on my work machine, so on
ubuntu, as well as onarchfdncred commentedon Mar 4, 2023
I know that
fzfreads env vars before/while launching. Do you have any of those set that could be affecting how it runs?amtoine commentedon Mar 4, 2023
the only thing i have is
FZF_DEFAULT_OPTSi think, but i've got the same issue withamtoine commentedon Mar 4, 2023
and this "hanging" issue only occurs when i try to
let var = ( ... | fzf)❕fdncred commentedon Mar 4, 2023
oh ya, i didn't try to assign it a variable. let me try that.
fdncred commentedon Mar 4, 2023
ya, it breaks without the str trim for me too when assigning to a var
amtoine commentedon Mar 4, 2023
aah cool, we're on the same page then 💪
yep i tried to assign the result to a variable, that's the crucial part of the problem i think, and it hangs
WindSoilder commentedon Mar 4, 2023
Sorry, I believe #8204 is the one to blame..
Revert "Throw out error if external command in subexpression is faile…
Revert "Throw out error if external command in subexpression is faile…