1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:38:11 +00:00

Shell: Accept null heredocs in POSIX mode

Fixes #21837.
This commit is contained in:
Ali Mohammad Pur 2023-11-17 21:39:56 +03:30 committed by Ali Mohammad Pur
parent 2eb0a8f3d2
commit aa73a7c961

View file

@ -1425,6 +1425,10 @@ ErrorOr<void> Heredoc::dump(int level) const
ErrorOr<RefPtr<Value>> Heredoc::run(RefPtr<Shell> shell)
{
if (shell && shell->posix_mode() && !m_contents) {
m_contents = make_ref_counted<StringLiteral>(position(), ""_string, StringLiteral::EnclosureType::None);
}
if (!m_contents) {
if (shell)
shell->raise_error(Shell::ShellError::EvaluatedSyntaxError, "Attempt to evaluate an unresolved heredoc"sv, position());