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 #1266 from sbesson/rebased/dev_4_4/11036_hql_pipeoutput

Do not enter interactive mode if hql command output is piped (rebased onto dev_4_4)