matklad / xshell

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Clarify in which sense the shell provides "independence of the host environment"

RalfJung opened this issue · comments

The docs say

Reliability: no shell injection by construction, good error messages with file paths, non-zero exit status is an error, independence of the host environment, etc.

I first thought this would mean that the shell doesn't forward the entire host environment to the called programs. However, a quick test with cmd!(Shell::new()?, "env").run()? showed that the environment is forwarded. It might be worth clarifying what is meant by "independence" here.

I think it's supposed to mean "host application working directory", not specifically environment variables. Being able to opt in to some of those might be useful, though.

That’s confusing! What I meant was rather that, if you use bash, you need to worry whether grep is a gnu grep or bsd grep, but, if you use Rust+xshell, you’ll just do line processing within your process, and it’ll work the same on Linux, windows, and Mac. That’s not an absolute truth, but with bash you by default gain dependency on ambient environment you program runs in, while in Rust (and with xshell in particular) default is cross platform by default.

Probably should have said “same behavior across platforms” there.