mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-20 00:02:19 +00:00
fix(bash): normalize CRLF line endings before running scripts (#10131)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -74,6 +74,18 @@ pub async fn handle_bash_job(
|
||||
occupancy_metrics: &mut OccupancyMetrics,
|
||||
_killpill_rx: &mut tokio::sync::broadcast::Receiver<()>,
|
||||
) -> Result<Box<RawValue>, Error> {
|
||||
// Normalize carriage returns to LF: bash reads a trailing `\r` as part of the
|
||||
// command and fails with `$'\r': command not found`. Content can arrive with
|
||||
// CRLF (Windows editor, browser paste, git sync) or a bare CR, so strip every
|
||||
// `\r` rather than trusting the source. Only allocate when one is present.
|
||||
let content_owned;
|
||||
let content = if content.contains('\r') {
|
||||
content_owned = content.replace("\r\n", "\n").replace('\r', "\n");
|
||||
content_owned.as_str()
|
||||
} else {
|
||||
content
|
||||
};
|
||||
|
||||
let annotation = windmill_common::worker::BashAnnotations::parse(&content);
|
||||
|
||||
// `# sandbox <image>` selects the daemonless, nsjail-sandboxed container runtime
|
||||
|
||||
Reference in New Issue
Block a user