Revision: 72347
          http://sourceforge.net/p/brlcad/code/72347
Author:   starseeker
Date:     2019-02-04 23:02:15 +0000 (Mon, 04 Feb 2019)
Log Message:
-----------
See if we can make this situation a bit more clear - shouldn't change anything 
functionality wise, but it will at least avoid any unwarranted assumptions 
about accidentally similar exit code behaviors on Windows...

Modified Paths:
--------------
    brlcad/trunk/src/libbu/CMakeLists.txt
    brlcad/trunk/src/libbu/kill.c
    brlcad/trunk/src/libbu/process.c

Added Paths:
-----------
    brlcad/trunk/src/libbu/process.h

Modified: brlcad/trunk/src/libbu/CMakeLists.txt
===================================================================
--- brlcad/trunk/src/libbu/CMakeLists.txt       2019-02-04 22:43:51 UTC (rev 
72346)
+++ brlcad/trunk/src/libbu/CMakeLists.txt       2019-02-04 23:02:15 UTC (rev 
72347)
@@ -159,6 +159,7 @@
   charclass.h
   mime.cmake
   parallel.h
+  process.h
   sha1.h
   vfont.h
   vls_vprintf.h

Modified: brlcad/trunk/src/libbu/kill.c
===================================================================
--- brlcad/trunk/src/libbu/kill.c       2019-02-04 22:43:51 UTC (rev 72346)
+++ brlcad/trunk/src/libbu/kill.c       2019-02-04 23:02:15 UTC (rev 72347)
@@ -29,6 +29,7 @@
 
 /* bu headers */
 #include "bu/process.h"
+#include "./process.h"
 
 /* c99 doesn't declare these */
 #if defined(HAVE_KILL) && !defined(__cplusplus)
@@ -90,7 +91,7 @@
     /* Finally, kill the parent */
     hProcess = OpenProcess(PROCESS_ALL_ACCESS, TRUE, (DWORD)process);
     if (hProcess != NULL) {
-       successful = TerminateProcess(hProcess, 1);
+       successful = TerminateProcess(hProcess, BU_MSVC_ABORT_EXIT);
        CloseHandle(hProcess);
     }
 

Modified: brlcad/trunk/src/libbu/process.c
===================================================================
--- brlcad/trunk/src/libbu/process.c    2019-02-04 22:43:51 UTC (rev 72346)
+++ brlcad/trunk/src/libbu/process.c    2019-02-04 23:02:15 UTC (rev 72347)
@@ -33,6 +33,7 @@
 #include "bu/process.h"
 #include "bu/str.h"
 #include "bu/vls.h"
+#include "./process.h"
 
 #if !defined(HAVE_DECL_WAIT) && !defined(wait) && !defined(_WINSOCKAPI_)
 extern pid_t wait(int *);
@@ -481,7 +482,7 @@
 
     GetExitCodeProcess(pinfo->hProcess, &retcode);
 
-    if (GetLastError() == ERROR_PROCESS_ABORTED || retcode == 1) {
+    if (GetLastError() == ERROR_PROCESS_ABORTED || retcode == 
BU_MSVC_ABORT_EXIT) {
        pinfo->aborted = 1;
     }
 

Added: brlcad/trunk/src/libbu/process.h
===================================================================
--- brlcad/trunk/src/libbu/process.h                            (rev 0)
+++ brlcad/trunk/src/libbu/process.h    2019-02-04 23:02:15 UTC (rev 72347)
@@ -0,0 +1,42 @@
+/*                      P R O C E S S . H
+ * BRL-CAD
+ *
+ * Copyright (c) 2013-2019 United States Government as represented by
+ * the U.S. Army Research Laboratory.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; see the file named COPYING for more
+ * information.
+ */
+
+/* Private libbu process related definitions shared between multiple files */
+
+#ifndef LIBBU_PROCESS_H
+#define LIBBU_PROCESS_H
+
+/* Apparently the termination code on Windows is arbitrary and somewhat
+ * ill-defined - see https://bugs.python.org/issue31863 for more info.  Try our
+ * own unlikely return number in the hopes of being relatively reliable for
+ * abort identification. */
+#define BU_MSVC_ABORT_EXIT 97101  /* ascii - a == 97 && e == 101 */
+
+#endif /* LIBBU_PROCESS_H */
+
+/*
+ * Local Variables:
+ * mode: C
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * c-file-style: "stroustrup"
+ * End:
+ * ex: shiftwidth=4 tabstop=8
+ */


Property changes on: brlcad/trunk/src/libbu/process.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
BRL-CAD Source Commits mailing list
brlcad-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to