Add shell=True for cat redirection command

- Shell redirection requires shell=True parameter in executioner
- Without shell=True, the > is treated as literal argument
- Fixes: File contents not being replaced
This commit is contained in:
usmannasir
2025-10-26 17:05:58 +05:00
parent fd1c53ffa4
commit f6fd2192c5

View File

@@ -1300,7 +1300,7 @@ def scanner_replace_file(request):
# Replace file using cat redirection (more reliable than cp for overwriting) # Replace file using cat redirection (more reliable than cp for overwriting)
# This ensures the file contents are actually replaced # This ensures the file contents are actually replaced
replace_cmd = f'cat "{user_temp_path}" > "{full_path}"' replace_cmd = f'cat "{user_temp_path}" > "{full_path}"'
replace_result = ProcessUtilities.executioner(replace_cmd, user=user) replace_result = ProcessUtilities.executioner(replace_cmd, user=user, shell=True)
# Clean up temp file # Clean up temp file
ProcessUtilities.executioner(f'rm -f "{user_temp_path}"', user=user) ProcessUtilities.executioner(f'rm -f "{user_temp_path}"', user=user)