 			(_ hdl: FileHandle) -> Void in
 			let data = hdl.availableData
 			if let str = String.stringFromData(data: data) {
-				CNExecuteInMainThread(doSync: false, execute: {
+				DispatchQueue.main.async {
 					() -> Void in
 					self.receiveInputStream(string: str)
 					self.scrollToBottom()
-				})
+				}
 			}
 		}
 		mErrorPipe.fileHandleForReading.readabilityHandler = {
 			(_ hdl: FileHandle) -> Void in
 			let data = hdl.availableData
 			if let str = String.stringFromData(data: data) {
-				CNExecuteInMainThread(doSync: false, execute: {
+				DispatchQueue.main.async {
 					self.receiveInputStream(string: str)
 					self.scrollToBottom()
-				})
+				}
 			}
 		}
 	}

					}
				}
			}
		})
	}

	private func updateForegroundColor() {

					switch key {
					case CNPreference.shared.terminalPreference.WidthItem:
						let newwidth = CNPreference.shared.terminalPreference.width
						if self.mTerminalInfo.width != newwidth {
							self.mTerminalInfo.width = newwidth
							self.invalidateIntrinsicContentSize()
							self.setNeedsLayout()
							self.notify(viewControlEvent: .updateSize)
						}
					case CNPreference.shared.terminalPreference.HeightItem:
						let newheight = CNPreference.shared.terminalPreference.height
						if self.mTerminalInfo.height != newheight {
							self.mTerminalInfo.height = newheight
							self.invalidateIntrinsicContentSize()
							self.setNeedsLayout()
							self.notify(viewControlEvent: .updateSize)
