Trim possible newlines from stdout data before printing to console