Skip to content

Commit

Permalink
Simplify stdpipe
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruin0x11 committed Dec 29, 2023
1 parent eab1091 commit 738b0bd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions clients/lsp-roslyn-stdpipe.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public static class StdPipe
var tasks = new Task<byte[]>[2]
{
ReadHeaderDelimitedAsync(pipeReader, false),
ReadHeaderDelimitedAsync(stdin, true)
ReadHeaderDelimitedAsync(pipeReader),
ReadHeaderDelimitedAsync(stdin)
};
while (true)
Expand All @@ -47,19 +47,19 @@ public static class StdPipe
stdout.Write(bytesRead, 0, bytesRead.Length);
stdout.Flush();
tasks[doneIdx] = ReadHeaderDelimitedAsync(pipeReader, false);
tasks[doneIdx] = ReadHeaderDelimitedAsync(pipeReader);
}
else
{
// stdin -> pipe out
pipeWriter.Write(bytesRead, 0, bytesRead.Length);
pipeWriter.Flush();
tasks[doneIdx] = ReadHeaderDelimitedAsync(stdin, true);
tasks[doneIdx] = ReadHeaderDelimitedAsync(stdin);
}
}
}
private static async Task<byte[]> ReadHeaderDelimitedAsync(Stream stream, bool isInput)
private static async Task<byte[]> ReadHeaderDelimitedAsync(Stream stream)
{
// Assigning new tasks with this function blocks the thread
// unless this is awaited first.
Expand Down

0 comments on commit 738b0bd

Please sign in to comment.