-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Fix Background Jobs in *nix and Windows #1972
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
Merged
+40
−2
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| Describe 'Basic Job Tests' -Tags 'CI' { | ||
|
|
||
| BeforeAll { | ||
| $job = Start-Job {1} | ||
| } | ||
|
|
||
| It 'Test job creation' { | ||
| $job | should not be $null | ||
| } | ||
|
|
||
| It 'Test job State' { | ||
| Wait-Job $job -Timeout 60 | ||
| $job.JobStateInfo.State -eq 'Completed' | should be $true | ||
| } | ||
|
|
||
| It 'Job output test' { | ||
| Receive-Job $job -wait | should be 1 | ||
| } | ||
|
|
||
| AfterAll { | ||
| Remove-Job $job -Force | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Is there a policy about missing
EOLatEOF?Personally, as someone who uses hg and git (and Linux), missing
EOLmarkers atEOFresult in lots of pain which I'd rather avoid.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 haven't seen a strong argument for requiring
EOLatEOF, and it comes up often enough to be somewhat annoying and distracting.If it's truly a problem for some tools, I think we should just run a tool over our source from time to time and fix it instead of asking each contributor every time we see it.
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'm not sure where to start.
The length of a file
""and the length of a file"\n"aren't the same.Version control systems at some point rely on hashing content and ensuring that they're reproducible.
diff and patch work on lines (things that end in
"\n"). A patch generated for a properly ended line doesn't apply well to an improperly ended line and vice versa. This makes it hard to graft and merge changes.Other things like
wc(word count tool which also does line count) can be implemented by counting\ns, a file"hello\n"can be defined to have1line because it has 1\n.Many text editors as a courtesy to other tools (like diff and vcs and ...) will automatically insert the
EOLatEOF.There's a general goal in VCS for commits to have descriptions that describe the entirety of their changes, and for blame to be assignable based on the last user to change a given line.
These factors result in a file like:
"hello.....\n......\nworld"which was created by one person but, where I change"hello"to"Hello"with a message of "capitalizing Hello" also resulting in my commit often changing the file to:"Hello.....\n......\nworld\n"And when someone uses a tool to quickly view the blame for lines of the file, they'll think that I was responsible for
"world\n".If you've ever had problems trying to apply changes where a patch was
\r\nand a file was\n, or where a file had mixed line endings, the missingEOLatEOFtriggers roughly similar failures.Trying to apply a change that's missing a line ending to a line that has a line ending:
Trying to apply a change with a line ending to a line that is missing a line ending:
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.
Converting the repository to not be missing line endings would be appreciated.
But I would still encourage you to also discourage people from adding files that are missing
EOLatEOFbecause unless your script automatically commits the line changes as the user who added the line, you'll be distorting authorship for those lines.