小编Jay*_*asi的帖子

C# - 进程没有终止

我在MySql中恢复备份.但是mysql exe并没有终止.这是我的代码 -

public override bool FullRestore(Stream fileStream)
    {
        try
        {
            ProcessStartInfo proc = new ProcessStartInfo();
            string cmd = string.Format("--database {0} --user={1} --password={2}", config.GetDbName(), config.GetUserName(), config.GetPassword());
            proc.FileName = "mysql";
            proc.RedirectStandardInput = true;
            proc.RedirectStandardOutput = false;
            proc.Arguments = cmd;
            proc.UseShellExecute = false;
            proc.CreateNoWindow = true;
            Process p = Process.Start(proc);
            Stream stream = p.StandardInput.BaseStream;
            Stream file = Utility.ZipNEncrypt.Unzip(fileStream, "XXXXXX");
            byte[] bytes = new byte[1024];
            for (int count = 0; (count = file.Read(bytes, 0, 1024)) > 0; )
            {
                stream.Write(bytes, 0, count);
            } …
Run Code Online (Sandbox Code Playgroud)

c# process

1
推荐指数
1
解决办法
308
查看次数

标签 统计

c# ×1

process ×1