Strip whitspaces after #!

Autotools configure scripts seem to use "#! /bin/sh"
This commit is contained in:
Ian Douglas Scott
2017-07-12 23:03:53 -07:00
parent 687f991ab4
commit b5da98396e

View File

@@ -584,6 +584,9 @@ pub fn exec(path: &[u8], arg_ptrs: &[[usize; 2]]) -> Result<usize> {
if data.starts_with(b"#!") {
if let Some(line) = data[2..].split(|&b| b == b'\n').next() {
// Strip whitespace
let line = &line[line.iter().position(|&b| b != b' ')
.unwrap_or(0)..];
if ! args.is_empty() {
args.remove(0);
}