\documentclass{article}
\usepackage{listings}
\newenvironment{hello}{\begin{lstlisting}[language=sh]}{\end{lstlisting}}
\begin{document}
\begin{hello}
ls
\end{hello}
\end{document}
The code cannot be compiled by xelatex, the compiler is hung.
What's the root cause?