declare_folded_class NO LONGER _in_file
[hiphop-php.git] / hphp / util / process-exec.h
blobfd4c097587c7953d0e1d4542d4366fff08bc5ccf
1 /*
2 +----------------------------------------------------------------------+
3 | HipHop for PHP |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-present Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
17 #pragma once
19 #include <string>
21 namespace HPHP::proc {
22 ////////////////////////////////////////////////////////////////////////////////
25 * Execute an external program. Unlike folly::Subprocess, this works with MSVC.
27 * @param path binary file's full path
28 * @param argv argument array
29 * @param in stdin
30 * @param out stdout
31 * @param err stderr; NULL for don't care
32 * @return true if program was executed, even if there was stderr;
33 * false if anything failed and unable to run the specified
34 * program
36 bool exec(const char* path, const char* argv[], const char* in,
37 std::string& out, std::string* err = nullptr, bool color = false);
40 * Daemonize current process.
42 void daemonize(const char* stdoutFile = "/dev/null",
43 const char* stderrFile = "/dev/null");
46 * RAII guard to temporarily re-enable forking.
48 struct EnableForkInDebuggerGuard {
49 EnableForkInDebuggerGuard();
50 ~EnableForkInDebuggerGuard();
52 static bool isForkEnabledInDebugger();
55 ////////////////////////////////////////////////////////////////////////////////