0
我正在为闭包编译器编写一个包装类,并且我得到了空字符串process.StandardOutput.ReadToEnd()
我写了下面的代码。通过process.StandardOutput.ReadToEnd()返回空白输出
public class ClosureCompiler
{
ProcessStartInfo psi = new ProcessStartInfo();
string _commandpath;
public ClosureCompiler(string commandpath)
{
_commandpath = commandpath;
psi.FileName = "java.exe";
psi.UseShellExecute = false;
psi.RedirectStandardOutput = true;
}
public string Compile(string sourcefile)
{
psi.Arguments = " -jar " + _commandpath + " --js " + sourcefile; // +" --js_output_file " + destinationfile + "";
var process = Process.Start(psi);
process.WaitForExit();
return process.StandardOutput.ReadToEnd();
}
}
但是当我从标准输出显示的命令行输出运行命令。