{"record":{"id":"4be94fe952f72ab4","repo":"tui-cs/Terminal.Gui","slug":"process-timed-out-command-line-process-startinf","errorCode":null,"errorMessage":"Process timed out. Command line: {process.StartInfo.FileName} {process.StartInfo.Arguments}.","messagePattern":"Process timed out\\. Command line: (.+?) (.+?)\\.","errorType":"exception","errorClass":"TimeoutException","httpStatus":null,"severity":"warning","filePath":"Terminal.Gui/App/Clipboard/ClipboardProcessRunner.cs","lineNumber":65,"sourceCode":"            RedirectStandardInput = true,\n            UseShellExecute = false,\n            CreateNoWindow = true\n        };\n\n        process.Start ();\n\n        if (!string.IsNullOrEmpty (input))\n        {\n            process.StandardInput.Write (input);\n            process.StandardInput.Close ();\n        }\n\n        if (!process.WaitForExit (5000))\n        {\n            var timeoutError =\n                $@\"Process timed out. Command line: {process.StartInfo.FileName} {process.StartInfo.Arguments}.\";\n\n            throw new TimeoutException (timeoutError);\n        }\n\n        if (waitForOutput && process.StandardOutput.Peek () != -1)\n        {\n            output = process.StandardOutput.ReadToEnd ();\n        }\n\n        if (process.ExitCode > 0)\n        {\n            output = $@\"Process failed to run. Command line: {cmd} {arguments}.\n\t\t\t\t\t\t\t\t\t\tOutput: {output}\n\t\t\t\t\t\t\t\t\t\tError: {process.StandardError.ReadToEnd ()}\";\n        }\n\n        return (process.ExitCode, output);\n    }\n}\n","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/tui-cs/Terminal.Gui/blob/2e47b11478db083499917f2ad27c34d30efb0df1/Terminal.Gui/App/Clipboard/ClipboardProcessRunner.cs#L47-L83","documentation":"Thrown as TimeoutException by ClipboardProcessRunner.Process when the spawned helper process (bash/xclip/xsel/etc.) does not exit within 5000ms. The message includes the command line for diagnosis. This protects the UI thread from hanging indefinitely on an unresponsive clipboard helper.","triggerScenarios":"The clipboard helper (xclip, xsel, pbcopy/pbpaste, wl-copy/wl-paste, or a bash -c wrapper) hangs — e.g. waiting on an X11 selection that never resolves, a dead clipboard daemon, or a frozen display server; the helper prompting for something interactively that blocks.","commonSituations":"xclip holding the clipboard selection open until another process claims it (classic xclip behavior over SSH); a stale clipboard manager; a wedged Wayland compositor; slow network filesystems affecting the helper's startup.","solutions":["Switch to a clipboard helper that daemonizes the selection, or use xclip with options that avoid holding the selection open.","Ensure a healthy clipboard daemon / display server is running in the session.","Catch TimeoutException and fall back to an in-memory clipboard or disable OS clipboard sync.","Prefer the Try* clipboard methods which do not throw on failure."],"exampleFix":"// before\nstring text = Application.Driver.Clipboard.GetClipboardData (); // helper hangs -> TimeoutException\n\n// after\nif (Application.Driver.Clipboard.TryGetClipboardData (out string text))\n{\n    // use text\n}\nelse\n{\n    // clipboard helper unavailable or timed out; degrade gracefully\n}","handlingStrategy":"try-catch","validationCode":"if (Application.Driver?.Clipboard?.TryGetClipboardData (out string text) == true)\n{\n    // use text — Try* methods do not throw on timeout/unsupported\n}","typeGuard":"static bool ClipboardReadSafely (out string text) =>\n    Application.Driver?.Clipboard?.TryGetClipboardData (out text) == true;","tryCatchPattern":"try\n{\n    string text = Application.Driver.Clipboard.GetClipboardData ();\n}\ncatch (TimeoutException ex)\n{\n    Logging.Warning ($\"Clipboard helper timed out: {ex.Message}\");\n    text = string.Empty;\n}","preventionTips":["Prefer TryGetClipboardData/TrySetClipboardData to avoid throws on timeout.","Use a clipboard helper that does not hold the selection open (avoid raw xclip over SSH).","Ensure a responsive clipboard daemon is running in the session."],"tags":["clipboard","process","timeout","environment"],"backgroundTag":null,"analyzedSha":"2e47b11478db083499917f2ad27c34d30efb0df1","analyzedAt":"2026-08-13T19:20:08.826Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}