• A
    Process::new etc should support non-utf8 commands/args · 046062d3
    Aaron Turon 提交于
    The existing APIs for spawning processes took strings for the command
    and arguments, but the underlying system may not impose utf8 encoding,
    so this is overly limiting.
    
    The assumption we actually want to make is just that the command and
    arguments are viewable as [u8] slices with no interior NULLs, i.e., as
    CStrings. The ToCStr trait is a handy bound for types that meet this
    requirement (such as &str and Path).
    
    However, since the commands and arguments are often a mixture of
    strings and paths, it would be inconvenient to take a slice with a
    single T: ToCStr bound. So this patch revamps the process creation API
    to instead use a builder-style interface, called `Command`, allowing
    arguments to be added one at a time with differing ToCStr
    implementations for each.
    
    The initial cut of the builder API has some drawbacks that can be
    addressed once issue #13851 (libstd as a facade) is closed. These are
    detailed as FIXMEs.
    
    Closes #11650.
    
    [breaking-change]
    046062d3
core-run-destroy.rs 3.8 KB