15.06.2022 22:56, Adriano dos Santos Fernandes wrote:

In Linux, when we do:

echo "select 1 from rdb\$database; select 2 from rdb\$database;" | isql
t.fdb

It shows:

     CONSTANT
============
            1


     CONSTANT
============
            2

In Windows,

echo select 1 from rdb$database; select 2 from rdb$database; | isql t.fdb

It shows:

SQL>
     CONSTANT
============
            1

SQL>
     CONSTANT
============
            2

The difference is due to stdin_redirected() considering file_type ==
FILE_TYPE_PIPE as a not redirection.

I think this is wrong.

See:

https://github.com/FirebirdSQL/firebird/commit/c8c7c3a44dad9572a55d6fed68f1c399a19366db

Initially (FB2) the code was:

if (GetFileType(in) == FILE_TYPE_DISK)
  Interactive = false;

then (circa 2.5) it was changed to:

if (GetFileType(in) == FILE_TYPE_CHAR)
  Interactive = true;

and later fixed to:

if (file_type == FILE_TYPE_CHAR || file_type == FILE_TYPE_PIPE)
  Interactive = true;

Are there any reason for that?

We have an old customer who uses (and distributes among clients, IIRC) their own GUI frontend for ISQL that tunnels console I/O using pipes and it should work as "interactive" mode.


Dmitry


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to