-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(dotnet): crash when TEMP contains certain unicode characters (#1913)
In certain environments, the temporary directory path may contain unicode characters. If those are not properly encoded as UTF-8 when sent to the `@jsii/kernel` process, a failure will occur when trying to access such paths. This change contains fixes for two possible sources of problems in such situations: 1. In `@jsii/runtime`, the `SyncStdio` class was a little too eager in turning it's `Buffer` to UTF-8 strings, as it could have only a part of a multi-byte character sequence (the conversion would then fail or result in corruption). Instead, it now looks for `\n` directly on the `Buffer`, and only performs string conversion once one has been found. 2. In the .NET Runtime, the `NodeProcess` class would spawn using the `System.Diagnostic.Process` class without specifying input and output encodings, which by default are the `System.Console` encoding. If that happens to not be `UTF-8`, the result could be unreliable. Instead, the encodings are now forced to `System.Text.Encoding.UTF8` for all three pipes of the child process (`Input`, `Output` and `Error`). Reproducing the conditions for the failure reported in aws/aws-cdk#7456 is somewhat difficult, especially in the context of CI/CD. This makes it difficult to validate those fixes actually deliver on their promises.
- Loading branch information
1 parent
f89ec65
commit 8f31b1a
Showing
3 changed files
with
18 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,4 @@ internal interface INodeProcess : IDisposable | |
|
||
TextReader StandardError { get; } | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters