void ProcessOnStarted() { if (!string.IsNullOrEmpty(WelcomeText)) { terminalView.Feed(WelcomeText + "\n"); } }
/// <summary> /// Launches the shell /// </summary> public void StartShell(string shellPath = "/bin/bash", string [] args = null) { // TODO: throw error if already started terminalView.Feed(WelcomeText + "\n"); var size = new UnixWindowSize(); GetUnixWindowSize(terminalView.Frame, terminalView.Terminal.Rows, terminalView.Terminal.Cols, ref size); var shellArgs = args == null ? new string [1] : new string [args.Length + 1]; shellArgs [0] = shellPath; args?.CopyTo(shellArgs, 1); shellPid = Pty.ForkAndExec(shellPath, shellArgs, Terminal.GetEnvironmentVariables(), out shellFileDescriptor, size); DispatchIO.Read(shellFileDescriptor, (nuint)readBuffer.Length, DispatchQueue.CurrentQueue, ChildProcessRead); }