[Box Backup-commit] COMMIT r1039 - box/chris/general/lib/server

boxbackup-dev at fluffy.co.uk boxbackup-dev at fluffy.co.uk
Sun Oct 15 14:42:33 BST 2006


Author: chris
Date: 2006-10-15 14:42:33 +0100 (Sun, 15 Oct 2006)
New Revision: 1039

Modified:
   box/chris/general/lib/server/LocalProcessStream.cpp
Log:

 * Don't bother to split up the command line on Win32 (it's never used)
 * Return the PID of the created process on Win32
 * Reformat and improve comments


Modified: box/chris/general/lib/server/LocalProcessStream.cpp
===================================================================
--- box/chris/general/lib/server/LocalProcessStream.cpp	2006-10-15 13:41:27 UTC (rev 1038)
+++ box/chris/general/lib/server/LocalProcessStream.cpp	2006-10-15 13:42:33 UTC (rev 1039)
@@ -35,19 +35,22 @@
 //
 // Function
 //		Name:    LocalProcessStream(const char *, pid_t &)
-//		Purpose: Run a new process, and return a stream giving access to it's
-//				 stdin and stdout. Returns the PID of the new process -- this
-//				 must be waited on at some point to avoid zombies.
+//		Purpose: Run a new process, and return a stream giving access
+//			 to its stdin and stdout (stdout and stderr on 
+//			 Win32). Returns the PID of the new process -- this
+//			 must be waited on at some point to avoid zombies
+//			 (except on Win32).
 //		Created: 12/3/04
 //
 // --------------------------------------------------------------------------
 std::auto_ptr<IOStream> LocalProcessStream(const char *CommandLine, pid_t &rPidOut)
 {
+#ifndef WIN32
+
 	// Split up command
 	std::vector<std::string> command;
 	SplitString(std::string(CommandLine), ' ', command);
 
-#ifndef WIN32
 	// Build arguments
 	char *args[MAX_ARGUMENTS + 4];
 	{
@@ -163,8 +166,11 @@
 	CloseHandle(procInfo.hThread);
 	CloseHandle(writeInChild);
 
+	rPidOut = (int)(procInfo.dwProcessId);
+
 	std::auto_ptr<IOStream> stream(new FileStream(readFromChild));
 	return stream;
+
 #endif // ! WIN32
 }
 




More information about the Boxbackup-commit mailing list