Issue 330: Fix BashRunner hanging on Linux
MODIFY
src/TextCopy/LinuxClipboard_2.0.cs
src/TextCopy/LinuxClipboard_2.0.cs
@@ -18,7 +18,7 @@ static class LinuxClipboard
File.WriteAllText(tempFileName, text);
try
{
- BashRunner.Run($"cat {tempFileName} | xclip -i -selection clipboard");
+ BashRunner.Run($"cat {tempFileName} | xsel -i --clipboard");
}
finally
{
@@ -36,7 +36,7 @@ static class LinuxClipboard
var tempFileName = Path.GetTempFileName();
try
{
- BashRunner.Run($"xclip -o -selection clipboard > {tempFileName}");
+ BashRunner.Run($"xsel -o --clipboard > {tempFileName}");
var readAllText = File.ReadAllText(tempFileName);
// ReSharper disable once RedundantTypeArgumentsOfMethod
return readAllText;

MODIFY
src/TextCopy/LinuxClipboard_2.1.cs
src/TextCopy/LinuxClipboard_2.1.cs
@@ -16,7 +16,7 @@ static class LinuxClipboard
return;
}
- BashRunner.Run($"cat {tempFileName} | xclip -i -selection clipboard");
+ BashRunner.Run($"cat {tempFileName} | xsel -i --clipboard ");
}
finally
{
@@ -30,7 +30,7 @@ static class LinuxClipboard
File.WriteAllText(tempFileName, text);
try
{
- BashRunner.Run($"cat {tempFileName} | xclip -i -selection clipboard");
+ BashRunner.Run($"cat {tempFileName} | xsel -i --clipboard ");
}
finally
{
@@ -43,7 +43,7 @@ static class LinuxClipboard
var tempFileName = Path.GetTempFileName();
try
{
- BashRunner.Run($"xclip -o -selection clipboard > {tempFileName}");
+ BashRunner.Run($"xsel -o --clipboard > {tempFileName}");
return File.ReadAllText(tempFileName);
}
finally
@@ -57,7 +57,7 @@ static class LinuxClipboard
var tempFileName = Path.GetTempFileName();
try
{
- BashRunner.Run($"xclip -o -selection clipboard > {tempFileName}");
+ BashRunner.Run($"xsel -o --clipboard > {tempFileName}");
return await File.ReadAllTextAsync(tempFileName, cancellation);
}
finally

Issue 330: Fix BashRunner hanging on Linux (#345)