Thanks for creating TextCopy, it's a great library. I use it in my CSharpRepl project, and it's worked well.
Is the feature request related to a problem: Yes
I'd like to be able to configure the process timeout in BashRunner. I recently had a bug report from a user about a timeout on Linux (ref https://github.com/waf/CSharpRepl/issues/327), and I see the process timeout is set to 500ms in BashRunner:
For reference, the stack trace reported by the user was:
System.Exception: Process timed out. Command line: bash -c "cat /tmp/tmpWDKMZj.tmp | xsel -i --clipboard ".
Output:
Error:
at BashRunner.Run(String commandLine) in /_/src/TextCopy/BashRunner.cs:line 32
at LinuxClipboard.InnerSetText(String tempFileName) in /_/src/TextCopy/LinuxClipboard_2.1.cs:line 42
at LinuxClipboard.SetTextAsync(String text, CancellationToken cancellation) in /_/src/TextCopy/LinuxClipboard_2.1.cs:line 22
... stack frames from application ...
I'm happy to adjust my application's usage if there's a better way of handling this.
Describe the solution
I can provide a PR for this feature, but there are a few different options for implementing it and I'm looking for guidance:
I could support it only for the async APIs, and then use the CancellationToken that's already there to control Process.WaitForExit (moving to Process.WaitForExitAsync).
I could provide some optional configuration option that would be passed to the SetText method (and possibly GetText, just for parity?). Either passing just a timespan/int timeout, or some ClipboardConfiguration class.
Similar to above, but support passing the configuration option to the Clipboard's instance constructor instead.
In my opinion, Option 1 is the best, but Option 2 or 3 would be good if there are other configuration scenarios you'd like to support. Thanks again for creating such a useful library.
Thanks for creating TextCopy, it's a great library. I use it in my CSharpRepl project, and it's worked well.
Is the feature request related to a problem: Yes
I'd like to be able to configure the process timeout in
BashRunner
. I recently had a bug report from a user about a timeout on Linux (ref https://github.com/waf/CSharpRepl/issues/327), and I see the process timeout is set to 500ms inBashRunner
:https://github.com/CopyText/TextCopy/blob/701c64408f75a7a5a8f4b0328372aca643a69c06/src/TextCopy/BashRunner.cs#L48
For reference, the stack trace reported by the user was:
I'm happy to adjust my application's usage if there's a better way of handling this.
Describe the solution
I can provide a PR for this feature, but there are a few different options for implementing it and I'm looking for guidance:
Process.WaitForExit
(moving toProcess.WaitForExitAsync
).SetText
method (and possiblyGetText
, just for parity?). Either passing just a timespan/int timeout, or some ClipboardConfiguration class.In my opinion, Option 1 is the best, but Option 2 or 3 would be good if there are other configuration scenarios you'd like to support. Thanks again for creating such a useful library.