src/cxx_supportlib/ProcessManagement/Spawn.h in passenger-5.3.4 vs src/cxx_supportlib/ProcessManagement/Spawn.h in passenger-5.3.5
- old
+ new
@@ -1,8 +1,8 @@
/*
* Phusion Passenger - https://www.phusionpassenger.com/
- * Copyright (c) 2010-2017 Phusion Holding B.V.
+ * Copyright (c) 2010-2018 Phusion Holding B.V.
*
* "Passenger", "Phusion Passenger" and "Union Station" are registered
* trademarks of Phusion Holding B.V.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -65,11 +65,29 @@
: pid(-1),
status(-1)
{ }
};
+struct SubprocessOutput {
+ /**
+ * The read subprocess output data.
+ */
+ string data;
+ /**
+ * Whether the entire file has been read. If false, then it
+ * means there is more data than specified through the `maxSize`
+ * parameter.
+ */
+ bool eof;
+
+ SubprocessOutput()
+ : eof(false)
+ { }
+};
+
+
// See ProcessManagement/Utils.h for definition
void printExecError(const char **command, int errcode);
/**
* Like system(), but properly resets the signal handler mask,
@@ -130,18 +148,19 @@
* that as much information as possible about the current state of things
* is stored in `info` so that the caller can clean things up appropriately.
*
* @param command The argument array to pass to execvp(). Must be null-terminated.
* @param info
+ * @param maxSize The maximum number of output bytes to read.
* @param killSubprocessOnInterruption Whether to automatically kill the subprocess
* when this function is interrupted.
* @param afterFork A function object to be called right after forking.
* @param onExecFail A function object to be called if exec fails.
* @throws SystemException
* @throws boost::thread_interrupted
*/
void runCommandAndCaptureOutput(const char **command, SubprocessInfo &info,
- string &output, bool killSubprocessOnInterruption = true,
+ SubprocessOutput &output, size_t maxSize, bool killSubprocessOnInterruption = true,
const boost::function<void ()> &afterFork = boost::function<void ()>(),
const boost::function<void (const char **command, int errcode)> &onExecFail = printExecError);
} // namespace Passenger