check output to have a "trim" function

I occasionally saw "object output has no method 'trim'". So it seems that `output` _sometimes_ evaluates to `true`, but is not a String typie. I therefore added an additional check.
I wasn't able to reproduce the error here at home, so I couldn't write a test.
At work the gulp tasks are more complex, so it be related to concurrency?