mitnk / cicada

An old-school bash-like Unix shell written in Rust
https://hugo.wang/cicada/
MIT License
981 stars 50 forks source link

kind: InvalidData #20

Closed denisgolius closed 5 years ago

denisgolius commented 5 years ago

cicada echo $HOSTNAME cicada: read_to_string error: Custom { kind: InvalidData, error: StringError("stream did not contain valid UTF-8") }

DISTRIB_ID=Ubuntu DISTRIB_RELEASE=18.04 DISTRIB_CODENAME=bionic DISTRIB_DESCRIPTION="Ubuntu 18.04.2 LTS" NAME="Ubuntu" VERSION="18.04.2 LTS (Bionic Beaver)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 18.04.2 LTS" VERSION_ID="18.04" HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" VERSION_CODENAME=bionic UBUNTU_CODENAME=bionic

uname -a Linux think 4.18.0-24-generic #25~18.04.1-Ubuntu SMP Thu Jun 20 11:13:08 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

mitnk commented 5 years ago

Hello,

I guess you're trying to do cicada -c 'echo $HOSTNAME' instead.

By cicada echo $HOSTNAME, you are actually running the echo file as a script, passing a param $HOMENAME.

If you replace cicada with bash, you would get an error msg: /bin/echo: cannot execute binary file, which is better one. I will try align cicada with bash in such case. Thanks for report!

denisgolius commented 5 years ago

Hello,

I guess you're trying to do cicada -c 'echo $HOSTNAME' instead.

By cicada echo $HOSTNAME, you are actually running the echo file as a script, passing a param $HOMENAME.

If you replace cicada with bash, you would get an error msg: /bin/echo: cannot execute binary file, which is better one. I will try align cicada with bash in such case. Thanks for report!

Thank you!

mitnk commented 5 years ago

Updated the error message on master:

$ cicada echo hi
cicada: /bin/echo: not a valid script file