Do not enter interactive mode if hql command output is piped

Return the output if sys.stdout.isatty() is False, i.e. when the hql command
is either piped or redirected to a file.
Merge pull request #1244 from sbesson/11036_hql_pipeoutput

Do not enter interactive mode if hql command output is piped