Skip to content

Commit

Permalink
add explanation
Browse files Browse the repository at this point in the history
  • Loading branch information
tedim52 committed Jul 2, 2024
1 parent e7b9878 commit 47174da
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,11 @@ func getTaskNameFromArgs(arguments *builtin_argument.ArgumentValuesSet) (string,
}
}

// Wraps [commandToRun] to enable streaming logs from tasks.
// Uses curly braces to execute the command(s) in the current shell.
// Adds an extra echo to ensure each log ends with a newline (may add an extra line at the end).
// Redirects output to /proc/1/fd/1 (init process's stdout) for Docker to pick up.
// Redirects stderr to stdout (can be disabled if not needed).
func getFullCommandToRun(commandToRun string) []string {
return []string{shellWrapperCommand, "-c", fmt.Sprintf("{ %v; echo; } %v %v %v", commandToRun, ">>", "/proc/1/fd/1", "2>&1")}
}

0 comments on commit 47174da

Please sign in to comment.