From 6a2ed4b333d0bef77509bc9b1b68fe374f77685e Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Wed, 5 Sep 2018 21:47:25 +0200 Subject: [PATCH] libcom/osi/windows: log errors using fprintf() instead of pop-up (fixes lp:1785712) --- src/libCom/osi/os/WIN32/osdProcess.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/src/libCom/osi/os/WIN32/osdProcess.c b/src/libCom/osi/os/WIN32/osdProcess.c index 6e69c0485..fbe68ba91 100644 --- a/src/libCom/osi/os/WIN32/osdProcess.c +++ b/src/libCom/osi/os/WIN32/osdProcess.c @@ -19,13 +19,13 @@ #endif #include +#include #define STRICT #include #define epicsExportSharedSymbols #include "osiProcess.h" -#include "errlog.h" epicsShareFunc osiGetUserNameReturn epicsShareAPI osiGetUserName (char *pBuf, unsigned bufSizeIn) { @@ -94,16 +94,11 @@ epicsShareFunc osiSpawnDetachedProcessReturn epicsShareAPI osiSpawnDetachedProce pFmtArgs[1] = (char *) pBaseExecutableName; pFmtArgs[2] = errStrMsgBuf; pFmtArgs[3] = "Changes may be required in your \"path\" environment variable."; - pFmtArgs[4] = "PATH = "; - pFmtArgs[5] = getenv ("path"); - if ( pFmtArgs[5] == NULL ) { - pFmtArgs[5] = ""; - } W32status = FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_STRING | FORMAT_MESSAGE_ARGUMENT_ARRAY | 80, - "%1 \"%2\". %3 %4 %5 \"%6\"", + "%1 \"%2\". %3 %4", 0, MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */ (LPTSTR) &complteMsgBuf, @@ -111,24 +106,20 @@ epicsShareFunc osiSpawnDetachedProcessReturn epicsShareAPI osiSpawnDetachedProce pFmtArgs ); if (W32status) { - /* Display the string. */ - MessageBox (NULL, complteMsgBuf, "Configuration Problem", - MB_OK | MB_ICONINFORMATION); + fprintf (stderr, "%s\n", (char *) complteMsgBuf); LocalFree (complteMsgBuf); } else { - /* Display the string. */ - MessageBox (NULL, errStrMsgBuf, "Failed to start executable", - MB_OK | MB_ICONINFORMATION); + fprintf (stderr, "%s\n", (char *) errStrMsgBuf); } /* Free the buffer. */ LocalFree (errStrMsgBuf); } else { - errlogPrintf ("!!WARNING!!\n"); - errlogPrintf ("Unable to locate executable \"%s\".\n", pBaseExecutableName); - errlogPrintf ("You may need to modify your \"path\" environment variable.\n"); + fprintf (stderr, "!!WARNING!!\n"); + fprintf (stderr, "Unable to locate executable \"%s\".\n", pBaseExecutableName); + fprintf (stderr, "You may need to modify your \"path\" environment variable.\n"); } return osiSpawnDetachedProcessFail; }