diff options
author | mistachkin <mistachkin@noemail.net> | 2018-07-22 06:25:35 +0000 |
---|---|---|
committer | mistachkin <mistachkin@noemail.net> | 2018-07-22 06:25:35 +0000 |
commit | 1e8487db29c940d07e2826a0663d72047a0104ea (patch) | |
tree | 7dfa2e4f7213c052885168e284f1d7dc9e118946 /src/tclsqlite.c | |
parent | 9676e611b647dc0d871aa3b5632e228c7d9e4679 (diff) | |
download | sqlite-1e8487db29c940d07e2826a0663d72047a0104ea.tar.gz sqlite-1e8487db29c940d07e2826a0663d72047a0104ea.zip |
In the Win32 VFS, when truncating a file, unmap it first.
FossilOrigin-Name: 21510a66dce4d0843ccfe20f092a01f5a52563ef244a94f1d5d2563305cab925
Diffstat (limited to 'src/tclsqlite.c')
-rw-r--r-- | src/tclsqlite.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/tclsqlite.c b/src/tclsqlite.c index e5984ec80..d0b4634d4 100644 --- a/src/tclsqlite.c +++ b/src/tclsqlite.c @@ -60,6 +60,7 @@ /* Used to get the current process ID */ #if !defined(_WIN32) +# include <signal.h> # include <unistd.h> # define GETPID getpid #elif !defined(_WIN32_WCE) @@ -69,6 +70,8 @@ # endif # include <windows.h> # endif +# include <io.h> +# define isatty(h) _isatty(h) # define GETPID (int)GetCurrentProcessId #endif @@ -3733,11 +3736,19 @@ int SQLITE_CDECL TCLSH_MAIN(int argc, char **argv){ #endif #if !defined(_WIN32_WCE) - if( getenv("BREAK") ){ - fprintf(stderr, - "attach debugger to process %d and press any key to continue.\n", - GETPID()); - fgetc(stdin); + if( getenv("SQLITE_DEBUG_BREAK") ){ + if( isatty(0) && isatty(2) ){ + fprintf(stderr, + "attach debugger to process %d and press any key to continue.\n", + GETPID()); + fgetc(stdin); + }else{ +#if defined(_WIN32) || defined(WIN32) + DebugBreak(); +#elif defined(SIGTRAP) + raise(SIGTRAP); +#endif + } } #endif |