osiSpawnDetachedProcess() prefix process name with '!' to silence warning
This commit is contained in:
@@ -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");
|
||||
|
||||
@@ -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" );
|
||||
|
||||
Reference in New Issue
Block a user