mirror of
https://github.com/mikefarah/yq.git
synced 2026-07-06 13:25:42 +00:00
Update pkg/yqlib/operator_system.go
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
parent
9a72c0f780
commit
6315cfe974
@ -93,7 +93,12 @@ func systemOperator(d *dataTreeNavigator, context Context, expressionNode *Expre
|
|||||||
return Context{}, fmt.Errorf("system command '%v' failed: %w", command, err)
|
return Context{}, fmt.Errorf("system command '%v' failed: %w", command, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
result := strings.TrimRight(string(output), "\n")
|
result := string(output)
|
||||||
|
if strings.HasSuffix(result, "\r\n") {
|
||||||
|
result = result[:len(result)-2]
|
||||||
|
} else if strings.HasSuffix(result, "\n") {
|
||||||
|
result = result[:len(result)-1]
|
||||||
|
}
|
||||||
newNode := candidate.CreateReplacement(ScalarNode, "!!str", result)
|
newNode := candidate.CreateReplacement(ScalarNode, "!!str", result)
|
||||||
results.PushBack(newNode)
|
results.PushBack(newNode)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user