diff --git a/CMakeLists.txt b/CMakeLists.txt index bd90490..ff68afb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -81,6 +81,13 @@ else() set(DEFAULT_CASE_INSENSITIVE FALSE) endif() +if (CYGWIN) + find_program(PKILL NAMES "pkill") + if(NOT PKILL) + message(FATAL_ERROR "pkill not found, please install procps-ng package.") + endif() +endif() + # Check for FUSE. find_package (FUSE REQUIRED) include_directories (SYSTEM ${FUSE_INCLUDE_DIR}) diff --git a/encfs/FileUtils.cpp b/encfs/FileUtils.cpp index 87a0ed4..ca3db78 100644 --- a/encfs/FileUtils.cpp +++ b/encfs/FileUtils.cpp @@ -1739,6 +1739,14 @@ void unmountFS(const char *mountPoint) { // fuse_unmount does not work on Mac OS, see #428 unmount(mountPoint, MNT_FORCE); #endif +#ifdef __CYGWIN__ + if(fork() == 0) + { + execl("/usr/bin/pkill", "/usr/bin/pkill", "-f", string("(^|/)encfs .*/.* ").append(mountPoint).append("?( |$)").c_str(), (char *)0); + } + int status; + wait(&status); +#endif } int remountFS(EncFS_Context *ctx) {