[Box Backup-dev] COMMIT r624 - box/chris/general/lib/common

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Thu Jun 8 19:18:49 BST 2006


Author: chris
Date: 2006-06-08 18:18:38 +0000 (Thu, 08 Jun 2006)
New Revision: 624

Modified:
   box/chris/general/lib/common/Test.h
Log:
* Test.h
- Allow LaunchServer to launch processes (in the background on Win32)
  that don't write a pid file (by passing NULL)


Modified: box/chris/general/lib/common/Test.h
===================================================================
--- box/chris/general/lib/common/Test.h	2006-06-08 18:17:35 UTC (rev 623)
+++ box/chris/general/lib/common/Test.h	2006-06-08 18:18:38 UTC (rev 624)
@@ -141,6 +141,16 @@
 	}
 #endif // WIN32
 
+	int pid = -1;
+
+#ifdef WIN32
+	if (pidFile == NULL)
+	{
+		pid = (int)procInfo.dwProcessId;
+	}
+	else
+	{
+#endif
 	// time for it to start up
 	::sleep(1);
 	
@@ -153,7 +163,6 @@
 	}
 	
 	FILE *f = fopen(pidFile, "r");
-	int pid = -1;
 	if(f == NULL || fscanf(f, "%d", &pid) != 1)
 	{
 		printf("Server: %s (pidfile %s)\n", CommandLine, pidFile);
@@ -171,6 +180,7 @@
 		TEST_FAIL_WITH_MESSAGE("Server wrote wrong pid to file");	
 		return -1;
 	}
+	} // if (pidFile != NULL)
 #endif
 
 	return pid;




More information about the Boxbackup-dev mailing list