SQLite Forum

Can -wal -shm files be deleted if -wal file is empty?
Login
And what is git doing when it runs sqldiff -- that is, what command line is it using, and how is it running the child process?

Windows (all versions up the the current version) will ABEND (**AB**normally **END** as in kill it by simply deleting the process) a process which produces output to either stderr or stdout which fills the pipe buffer if the parent is not "reading" from its end of the pipe (technically an I/O error is signalled, but the console mode application has no way to receive the signal and can do nothing about it anyway, so it just crashes).

This means that if the database is in WAL mode and has created WAL and SHM files that when it is simply terminated without the opportunity to properly wipe up after itself, then the journal files will be left behind.  They are empty because the database was only read (not updated) so there has been no updated pages written to the WAL journal.

This is most often seen when attempting to convert "Windows Console" applications to run as services because the service manager does provide hooks for stdin/stdout/stderr but does not just redirect them to/from /dev/nul but attaches them to "dead end pipes".  Reading stdin returns EOF but you can write to stdout/stderr and when the pipe buffer fills windows signals an I/O error which the program cannot handle causing it to crash.

I suspect that you would need to tell git to spawn the process and produce output to some temporary file in which it expects to find the output and use the `--changeset <filename>` option to tell sqldiff to write its output to that file.

It is also possible, I suppose, that git is reading the output but something is causing it to terminate the child rather than allowing it to exit normally.