Prevent drupal_messages in drush
I just realized they are just printed to the command line and are not contained in the return value itself. So it is actually working. Since I was printing my variable directly for debugging it looked like it contained the messages as well.