-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
Description
Description
Following code starting process and reading stdout works fine in netcoreapp3.1:
internal class Program
{
private static void Main(string[] args)
{
Console.WriteLine("Hello World!");
using (var process = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = "wkhtmltopdf",
Arguments =
"-q -B 8 -L 8 -R 8 -T 8 --print-media-type --enable-local-file-access -s Letter -O Portrait - -",
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true,
RedirectStandardInput = true,
CreateNoWindow = true
}
})
{
process.Start();
byte[] array;
var html = "test";
using (var standardInput = process.StandardInput)
{
standardInput.WriteLine(html);
}
using (var memoryStream = new MemoryStream())
{
using (var baseStream = process.StandardOutput.BaseStream)
{
var buffer = new byte[4096];
int count;
while ((count = baseStream.Read(buffer, 0, buffer.Length)) > 0)
memoryStream.Write(buffer, 0, count);
}
var end = process.StandardError.ReadToEnd();
if (memoryStream.Length == 0L)
throw new Exception(end);
process.WaitForExit();
array = memoryStream.ToArray();
}
Console.WriteLine(array.Length);
}
}
}but fails in net5.0 with:
System.Exception: QPainter::begin(): Returned false
Exit with code 1, due to unknown error.
Configuration
- dotnet --version:
5.0.101 - Ubuntu 20.04.1 LTS
- wkhtmltox_0.12.6-1.bionic_amd64
Regression?
Works in netcoreapp3.1
Other information
related:
- Linux version cannot write on STDOUT when wkhtmltopdf used as a child-process. wkhtmltopdf/wkhtmltopdf#3119
- Failure on .NET 5.0 fpanaccia/Wkhtmltopdf.NetCore-deprecated#46 (comment)
- QPainter::begin(): Returned false Exit with code 1, due to unknown error. .net 5 docker linux fpanaccia/Wkhtmltopdf.NetCore.Example-deprecated#14
Reactions are currently unavailable