Title: Make the current location for script blocks executing in background/thread jobs default to the caller's in all scenarios · Issue #10673 · PowerShell/PowerShell · GitHub
Open Graph Title: Make the current location for script blocks executing in background/thread jobs default to the caller's in all scenarios · Issue #10673 · PowerShell/PowerShell
X Title: Make the current location for script blocks executing in background/thread jobs default to the caller's in all scenarios · Issue #10673 · PowerShell/PowerShell
Description: Update: This proposal has been approved - the remaining work is summarized in this comment. Ideally, we'd have a consistent experience across all background-/thread-job related features, meaning that all of the following should exhibit t...
Open Graph Description: Update: This proposal has been approved - the remaining work is summarized in this comment. Ideally, we'd have a consistent experience across all background-/thread-job related features, meaning th...
X Description: Update: This proposal has been approved - the remaining work is summarized in this comment. Ideally, we'd have a consistent experience across all background-/thread-job related features, meanin...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/10673
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Make the current location for script blocks executing in background/thread jobs default to the caller's in all scenarios","articleBody":"Update: This proposal [has been approved](https://github.com/PowerShell/PowerShell/issues/10673#issuecomment-540229636) - the remaining work is summarized in [this comment](https://github.com/PowerShell/PowerShell/issues/10673#issuecomment-540349744).\r\n\r\n---\r\n\r\nIdeally, we'd have a _consistent_ experience across _all_ background-/thread-job related features, meaning that all of the following should exhibit the same behavior with respect to the current location that the script block being passed sees (by default: \r\n\r\n * (a) `Start-Job`\r\n * (b) `Start-ThreadJob`\r\n * (c) postpositional `&` to start a job (implicit `Start-Job`)\r\n * (d) `ForEach-Object -Parallel`\r\n\r\nThe most sensible location to use is the _caller's_ current location, which (c) already uses and (d) will, once #10672 is merged.\r\n\r\n**The proposal is to make (a) and (b) behave like (c) and (d) for overall consistency and use of a sensible default**:\r\n\r\n(b) (`Start-ThreadJob`) was _meant_ to be modeled after `Start-Job`'s example, but currently isn't: it uses the - virtually unpredictable from a user's perspective - process-wide working directory; given that, it shouldn't be too late to change it - see https://github.com/PaulHigin/PSThreadJob/issues/46\r\n\r\n(a) (`Start-Job`) regrettably has always defaulted to `$HOME` (the filesystem provider's home location).\r\n \r\nThe question now is:\r\n\r\n**Can we consider `Start-Job`'s default-to-`$HOME` behavior a bug / something worth fixing as a [Bucket 3: Unlikely Grey Area](https://github.com/PowerShell/PowerShell/blob/master/docs/dev-process/breaking-change-contract.md#bucket-3-unlikely-grey-area) change?**\r\n\r\nI'm certainly personally in favor of that, but I haven't looked into how likely it is that existing `Start-Job` code relies on `$HOME` to be the default directory.\r\n\r\n@iSazonov's take (from his comment at https://github.com/PowerShell/PowerShell/issues/10537#issuecomment-536199173):\r\n\r\n> I suggest to consider `Start-Job` case as _bug_.\r\nIf my work folder is `c:\\work` and I run a job which switched to `$home` that is `c:\\users\\isazonov` - the last place is the worst place where user would like to see a resulting file. We could guess that user would use relative path to `Documents` folder. But most likely when faced with this inconsistency, the user will use the exact path to the working directory (`c:\\work`), especially since the job is perceived as some kind of background process.\r\n","author":{"url":"https://github.com/mklement0","@type":"Person","name":"mklement0"},"datePublished":"2019-10-01T21:20:38Z","url":"https://github.com/PowerShell/PowerShell/issues/10673"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d71347b7-bff3-1149-4320-1b73c76b2341 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A376:1ABC75:254D679:3406CFB:6AFD4493 |
| html-safe-nonce | 39e2005d9e77f9b79d60e5b9958cb9af5d67942e0ce2817fec121bdbca7a12ef |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMzc2OjFBQkM3NToyNTRENjc5OjM0MDZDRkI6NkFGRDQ0OTMiLCJ2aXNpdG9yX2lkIjoiMzIzNjYxNzc0NzUyNTYxNjc4NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 737e767c04ace61e34004cf431fdbe82630456f23cd64df03d5143599e51189f |
| hovercard-subject-tag | issue:501152424 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/10673/issue_layout |
| twitter:image | https://opengraph.githubassets.com/07186daefb4e8959d82d1b3e59e87a9141d8dce5b31a2b4656dbaea5daf8dd8c/PowerShell/PowerShell/issues/10673 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/07186daefb4e8959d82d1b3e59e87a9141d8dce5b31a2b4656dbaea5daf8dd8c/PowerShell/PowerShell/issues/10673 |
| og:image:alt | Update: This proposal has been approved - the remaining work is summarized in this comment. Ideally, we'd have a consistent experience across all background-/thread-job related features, meaning th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | mklement0 |
| hostname | github.com |
| expected-hostname | github.com |
| None | bdbacc25b921224ff0befcb9e629560a1255be51aec9991d6e3f95b5e9151474 |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 556dd37bb0aceffb25724e151b5d858b3265b40b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width