Introduce a conceptual help topic about calling external programs (native applications)
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
- Loại issue
- Tài liệu
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- powershell
- Lĩnh vực
- documentation
Hướng nghiên cứu
Bắt đầu bằng việc xem xét about_Parsing, about_Quoting_Rules, about_Redirection, about_Pipelines, about_pwsh và about_Operators, cùng với các issue liên quan và RFC. Soạn thảo chủ đề about_Native_Calls được đề xuất cho phần about_*, bao quát hành vi của chương trình native được liệt kê và liên kết đến các bài viết đó; công việc được xem là hoàn tất khi hướng dẫn toàn diện đã được thêm vào và đưa vào TOC.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Related: #2361, https://github.com/PowerShell/PowerShell/issues/13068#issuecomment-653526374, and #6239
Summary of the new document or enhancement
Many special considerations apply when you call an external command-line executable (aka native application / utility), which aren't currently covered comprehensively, in one place:
-
That the only data type supported is text (
[string]), both on input and output, and how raw byte data is fundamentally unsupported - both when collecting the output in PowerShell and when piping between native programs.- Update: v7.4 introduced raw byte support.
-
How there are syntax pitfalls due to PowerShell's extended set of metacharacters (compared to other shells) causing potential misinterpretation of arguments, which must be avoided with quoting (e.g., To pass literal
@foo, which works unquoted incmd.exeandbash, you must use'@foo'in PowerShell).- How
--%can be used (primarily on Windows) to selectively deactivate PowerShell's parsing.
- How
-
How "native globbing" is automatically applied to arguments such as
*.txton Unix-like platforms; that is,*.txtis implicitly replaced with the array of file names / paths matching that wildcard pattern. -
How output data is sent through the pipeline line by line, resulting in an array of strings (lines), if collected in a variable.
-
How stderr (standard error) output is passed through to the host rather than going through PowerShell's error stream and can only be captured with a
2>redirection. -
How redirections (
>) generally do not pass the native program's output through as-is, but invariably treat it as[Console]::OutputEncodingencoded text that on writing to the target file is written with PowerShell's default encoding (BOM-less UTF-8 in PowerShell 6+, UTF-16LE in Windows PowerShell). -
How external-program calls aren't integrated with PowerShell's error handling and require explicit checking of
$?/$LASTEXITCODEto detect failure, except in PowerShell 7, where pipeline chain operators&&and||can now be used. See also: the RFC that proposes improvements to the integration. -
How
&, the call operator, must be used to invoke executables whose paths are / must be quoted (as a whole) and/or contain variable references or subexpressions (this requirement isn't specific to external programs, but most likely to surface in that context). -
How
Start-Processis typically not the right tool for invoking external programs - see #6239.
Details of requested document:
- Proposed title: about_Native_Calls
- Propose location in the TOC: Among the `about_* topics
- Target audience: end users
- Purpose or scenario: guidance for invoking native command-line programs
- List of related articles to link to: about_Parsing, about_Quoting_Rules, about_Redirection, about_Pipelines, about_pwsh, about_Operators (section "Pipeline chain operators && and ||")
- Ngôn ngữ chính
- PowerShell
- Star
- 2.5k
- Fork
- 1.7k
- Merge trung bình
- 6 giờ 43 phút
- Pull request đã merge (30 ngày)
- 34
Chuẩn bị môi trường
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của MicrosoftDocs/PowerShell-Docs
-
issue-doc-idea needs-triage
Độ khó 2/5 1-2 ngày Mức phù hợp với người mới 86/100
MicrosoftDocs/PowerShell-Docs#13306 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-triage
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
MicrosoftDocs/PowerShell-Docs#13305 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
hold-for-pr hold-for-release issue-doc-idea
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
MicrosoftDocs/PowerShell-Docs#13195 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
hold-for-pr hold-for-release
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
MicrosoftDocs/PowerShell-Docs#12897 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add "Avoid function / scriptblock based recursion" section to `Performance Considerations` documentĐang mởarea-sdk-docs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
MicrosoftDocs/PowerShell-Docs#11037 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của MicrosoftDocs/PowerShell-Docs
Issue tương tự
-
module-request
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Complexity: Small P-Feature: Projects page ready for merge team role: back end/devOps role: front end size: 0.25pt
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 67/100
bellingcat/toolkit#905 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
blinklabs-io/gouroboros#2577 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày