SQLite Forum

Strange CLI .exit issue
Login
Earlier, you wrote:

> ftype sqlite3=cmd /c "type %1 | c:\\bins\\sqlite3.exe -batch %*"

If you entered that command, literally, the %1 and %* will expand to nothing as seen by ftype. I'm going to pretend below that you escaped the % characters.

When the system shell expands this for the extension you have associated with "sqlite" files, for the command line "sample.sql" the result will be:<code>
   cmd /c type sample.sql | c:\\bins\\sqlite3.exe -batch sample.sql
</code>, which you must admit is strange. As your sqlite3 invocation is written, it will try to open sample.sql as a database, and as the whole pipeline is written/read, the type command will be trying to copy its content to stdout which is piped to sqlite3's stdin. I'm not sure what **should** happen in this case, but I am far from declaring that what you have reported as happening **should not** happen and represents a fixable bug in the SQLite3 shell.

Given that I do not see a bug, I see the correct solution as "do nothing". And because your solution is not "do nothing", I suspect it is incorrect.

If you could show a shell usage scenario for which useful behavior should be expected from the ordinary, understandable rules of cmd.exe [a] but cannot happen due to sqlite3.exe's behavior, we may have a bona fide bug. But I'm not there yet.

----

a. That's not entirely a joke. There are some commonly understood rules, and the interaction of a file being both opened by "type" and opened by another process for exclusive access is not among that rule set.