| | |
| | | { |
| | | if (null == _dbHelper) |
| | | { |
| | | _dbHelper = new PostgreHelper(DbEnum.langfang); |
| | | _dbHelper = new PostgreHelper(); |
| | | } |
| | | |
| | | return _dbHelper; |
| | |
| | | p.StartInfo.CreateNoWindow = true; |
| | | //p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; |
| | | p.StartInfo.RedirectStandardInput = true; |
| | | p.StartInfo.RedirectStandardOutput = true; |
| | | p.StartInfo.RedirectStandardOutput = isOut; |
| | | p.StartInfo.RedirectStandardError = true; |
| | | p.Start(); |
| | | |
| | | task.pid = p.Id; |
| | | task.id = TaskDBHelper.Insert(task); |
| | | |
| | | StreamWriter si = p.StandardInput; // 标准输入流 |
| | | StreamReader so = isOut ? p.StandardOutput : null; // 标准输出流 |
| | |
| | | str = se.ReadToEnd(); |
| | | |
| | | //if (!string.IsNullOrEmpty(info)) LogOut.Debug(info); |
| | | if (!string.IsNullOrEmpty(str)) LogOut.Error(str); |
| | | if (!string.IsNullOrEmpty(str) && !str.Contains("@jit(cache=True, nogil=True)")) LogOut.Error(str); |
| | | if (p.HasExited == false) p.Kill(); |
| | | |
| | | task = TaskDBHelper.SelectById(task.id); |
| | | if (null != task && task.status < 2) |
| | | { |
| | | task.status = 2; |
| | | TaskDBHelper.Update(task); |
| | | } |
| | | |
| | | if (null != so) so.Close(); |
| | | se.Close(); |
| | | //so.Close(); |
| | | si.Close(); |
| | | p.Close(); |
| | | } |
| | |
| | | { |
| | | LogOut.Error(ex.Message + "\r\n" + ex.StackTrace); |
| | | str = ex.Message; |
| | | task = TaskDBHelper.SelectById(task.id); |
| | | if (null != task && task.status < 2) |
| | | { |
| | | task.err = ex.Message; |
| | | task.status = 4; |
| | | TaskDBHelper.Update(task); |
| | | } |
| | | } |
| | | |
| | | return str; |