-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Replace CR and new line with a 0x23CE character #10616
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace CR and new line with a 0x23CE character #10616
Conversation
src/System.Management.Automation/engine/runtime/CompiledScriptBlock.cs
Outdated
Show resolved
Hide resolved
| textToLog = textToLog.Replace('\u0000', '\u2400'); | ||
| #if UNIX | ||
| if (Platform.IsLinux) | ||
| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This check is not needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? This is only an issues for SysLog, not OsLog on macOS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it. Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the case it would be good to have the protection comment in the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can repeat the comment if you want
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is explained on line 1584
src/System.Management.Automation/engine/runtime/CompiledScriptBlock.cs
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/engine/runtime/CompiledScriptBlock.cs
Outdated
Show resolved
Hide resolved
|
Talked with @TravisEz13 about the concern of creating 3 large strings for |
src/System.Management.Automation/engine/runtime/CompiledScriptBlock.cs
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/engine/runtime/CompiledScriptBlock.cs
Outdated
Show resolved
Hide resolved
src/System.Management.Automation/engine/runtime/CompiledScriptBlock.cs
Outdated
Show resolved
Hide resolved
| [string] $powershell = Join-Path -Path $PSHome -ChildPath 'pwsh' | ||
| $scriptBlockCreatedRegExTemplate = @" | ||
| Creating Scriptblock text \(1 of 1\):#012{0}(`u{23CE}|\?|#012)*ScriptBlock ID: [0-9a-z\-]*#012Path:.* | ||
| Creating Scriptblock text \(1 of 1\):#012{0}(⏎|#012)*ScriptBlock ID: [0-9a-z\-]*#012Path:.* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this? `u{23CE} looks more clear for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests fail if we use the escape sequence.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to copy and paster the code in console and lost the char. Also the tests become unreadable. I wonder why doesn't the Unicode syntax sugar work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember that we had Unicode chars in files and it was a headache - editors silently break them. After that we made a conclusion to keep all files in ASCII.
|
🎉 Handy links: |
PR Summary
Replace CR and new line with a 0x23CE character
PR Context
Trying to document how to use logging with Azure Log Analytics and RSyslog converting these to
#012and#013PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.