In my pdf created from latex sources I can see that sometimes \lstinputlisting will have a page break in the middle just because it happened to be in the end of the page. I would like to prevent it.
The solution (not marked as accepted) from https://tex.stackexchange.com/questions/27722/how-to-prevent-a-lstinputlisting-being-split-across-pages
is not helping since it make the listing to float.
Is there any other solution to prevent page breaking before \lstinputlisting ?