Пример #1
0
 private static void WaitForExit(IWebSocketEventSender websocket, IContainerProcess process)
 {
     try
     {
         var exitCode = process.WaitForExit();
         websocket.SendEvent("close", exitCode.ToString());
         websocket.Flush();
         websocket.Close(System.Net.WebSockets.WebSocketCloseStatus.NormalClosure, "process finished");
     }
     catch (Exception e)
     {
         websocket.SendEvent("close", "-1");
         websocket.Flush();
         websocket.Close(System.Net.WebSockets.WebSocketCloseStatus.InternalServerError, e.Message);
     }
 }
Пример #2
0
 private static void WaitForExit(IWebSocketEventSender websocket, IContainerProcess process)
 {
     try
     {
         var exitCode = process.WaitForExit();
         websocket.SendEvent("close", exitCode.ToString());
         websocket.Flush();
         // websocket.Close(System.Net.WebSockets.WebSocketCloseStatus.NormalClosure, "process finished");
     }
     catch (Exception e)
     {
         websocket.SendEvent("close", "-1");
         websocket.Flush();
         // websocket.Close(System.Net.WebSockets.WebSocketCloseStatus.InternalServerError, e.Message);
     }
 }
Пример #3
0
 private IContainerProcess Run(IWebSocketEventSender websocket, ProcessSpec processSpec)
 {
     try
     {
         var processIO = new ProcessIO(websocket);
         var process   = container.Run(processSpec, processIO);
         websocket.SendEvent("pid", process.Id.ToString());
         return(process);
     }
     catch (Exception e)
     {
         websocket.SendEvent("error", e.Message);
         websocket.Close(System.Net.WebSockets.WebSocketCloseStatus.InternalServerError, e.Message);
         return(null);
     }
 }
Пример #4
0
 private IContainerProcess Run(IWebSocketEventSender websocket, ProcessSpec processSpec)
 {
     try
     {
         var processIO = new ProcessIO(websocket);
         var process = container.Run(processSpec, processIO);
         websocket.SendEvent("pid", process.Id.ToString());
         return process;
     }
     catch (Exception e)
     {
         websocket.SendEvent("error", e.Message);
         websocket.Close(System.Net.WebSockets.WebSocketCloseStatus.InternalServerError, e.Message);
         return null;
     }
 }
Пример #5
0
 public override void Write(string value)
 {
     ws.SendEvent(streamName, value + "\r\n");
 }