osiSpawnDetachedProcess() prefix process name with '!' to silence warning

This commit is contained in:
Michael Davidsaver
2021-04-19 10:59:50 -07:00
parent f8e720da28
commit a9457fc02b
2 changed files with 10 additions and 2 deletions

View File

@@ -50,10 +50,14 @@ LIBCOM_API osiGetUserNameReturn epicsStdCall osiGetUserName (char *pBuf, unsigne
LIBCOM_API osiSpawnDetachedProcessReturn epicsStdCall osiSpawnDetachedProcess
( const char *pProcessName, const char *pBaseExecutableName )
{
BOOL silent = pProcessName && pProcessName[0]=='!';
BOOL status;
STARTUPINFO startupInfo;
PROCESS_INFORMATION processInfo;
if(silent)
pProcessName++; /* skip '!' */
GetStartupInfo ( &startupInfo );
startupInfo.lpReserved = NULL;
startupInfo.lpTitle = (char *) pProcessName;
@@ -115,7 +119,7 @@ LIBCOM_API osiSpawnDetachedProcessReturn epicsStdCall osiSpawnDetachedProcess
/* Free the buffer. */
LocalFree (errStrMsgBuf);
}
else {
else if(!silent) {
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");

View File

@@ -63,8 +63,12 @@ LIBCOM_API osiSpawnDetachedProcessReturn epicsStdCall osiSpawnDetachedProcess
(const char *pProcessName, const char *pBaseExecutableName)
{
int status;
int silent = pProcessName && pProcessName[0]=='!';
int fds[2]; /* [reader, writer] */
if(silent)
pProcessName++; /* skip '!' */
if(pipe(fds))
return osiSpawnDetachedProcessFail;
@@ -137,7 +141,7 @@ LIBCOM_API osiSpawnDetachedProcessReturn epicsStdCall osiSpawnDetachedProcess
* Run the specified executable
*/
status = execlp (pBaseExecutableName, pBaseExecutableName, (char *)NULL);
if ( status < 0 ) {
if ( status < 0 && !silent ) {
fprintf ( stderr, "**** The executable \"%s\" couldn't be located\n", pBaseExecutableName );
fprintf ( stderr, "**** because of errno = \"%s\".\n", strerror (errno) );
fprintf ( stderr, "**** You may need to modify your PATH environment variable.\n" );