mirror of
https://github.com/tiennm99/coolify.git
synced 2026-04-17 23:20:43 +00:00
fix: add bash control structure keywords to sudo command processing
Fixes issue #7346 where proxy startup failed on non-root servers due to bash syntax errors when control structure keywords like 'for', 'do', 'done', 'break', and 'continue' were being prefixed with 'sudo'. Added comprehensive exclusion list including for/while/until/case/select loops, conditionals (if/then/else/elif/fi), and loop control keywords (break/continue). Also excludes comment lines starting with '#'. All 37 unit tests pass, including new tests for each bash control structure. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -31,6 +31,20 @@ function parseCommandsByLineForSudo(Collection $commands, Server $server): array
|
||||
'true',
|
||||
'if',
|
||||
'fi',
|
||||
'for',
|
||||
'do',
|
||||
'done',
|
||||
'while',
|
||||
'until',
|
||||
'case',
|
||||
'esac',
|
||||
'select',
|
||||
'then',
|
||||
'else',
|
||||
'elif',
|
||||
'break',
|
||||
'continue',
|
||||
'#',
|
||||
])
|
||||
) {
|
||||
return "sudo $line";
|
||||
|
||||
Reference in New Issue
Block a user