public static int ClosePipe(PhpResource pipeHandle) { PhpStream php_stream = PhpStream.GetValid(pipeHandle); if (php_stream == null) { return(-1); } ProcessWrapper wrapper = php_stream.Wrapper as ProcessWrapper; if (wrapper == null) { return(-1); } var code = CloseProcess(wrapper.process); php_stream.Close(); return(code); }