Fix edit command

Kubernetes-commit: 2ae37c8046128e0191ec96c8b31361ae894f2330
This commit is contained in:
yylt 2021-10-21 20:07:38 +08:00 committed by Kubernetes Publisher
parent 8165f83007
commit 0198d9185e
1 changed files with 3 additions and 1 deletions

View File

@ -725,7 +725,9 @@ func ManualStrip(file []byte) []byte {
stripped := []byte{}
lines := bytes.Split(file, []byte("\n"))
for i, line := range lines {
if bytes.HasPrefix(bytes.TrimSpace(line), []byte("#")) {
trimline := bytes.TrimSpace(line)
if bytes.HasPrefix(trimline, []byte("#")) && !bytes.HasPrefix(trimline, []byte("#!")) {
continue
}
stripped = append(stripped, line...)