Skip to content
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

Update SF-0007 Subprocess to version 6 #1112

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

iCharlesHu
Copy link
Contributor

v6: String support, minor changes around IO and closure sending requirements:

  • Added a Configuration based overload for runDetached.
  • Updated input types to support: Sequence<UInt8>, Sequence<Data> and AsyncSequence<Data> (dropped AsyncSequence<UInt8> in favor of AsyncSequence<Data>).
  • Added isolation parameter for closure based .run methods.
  • Dropped sending requirement for closure passed to .run.
  • Windows: renamed ProcessIdentifier.processID to ProcessIdentifier.value.
  • Updated TeardownStep to use Duration instead of raw nanoseconds.
  • Switched all generic parameters to full words instead of a letter.
  • Introduced String support:
    • Added some StringProtocol input overloads for run().
    • Changed CollectedResult.standard{Output|Error} to OutputWrapper, which offers convenient views to the outputs as Data and String with UTF8 encoding

@iCharlesHu iCharlesHu requested a review from itingliu January 7, 2025 00:15
@iCharlesHu iCharlesHu added the proposal This PR is for a proposal label Jan 7, 2025
@iCharlesHu
Copy link
Contributor Author

@swift-ci please test

/// - output: A file descriptor to bind to the subprocess' standard output.
/// - error: A file descriptor to bind to the subprocess' standard error.
/// - Returns: the process identifier for the subprocess.
public static func runDeatched(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still doubting we need this really. Why doesn't this work

Task {
  await Subprocess.run(...)
}

Since this is an unstructured task that's never retained nor cancelled it should run forever and when the program exits nothing is waiting for the task to finish or cancels it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@FranzBusch Can you comment in the pitch thread?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did leave a comment regarding this already here: https://forums.swift.org/t/review-2nd-sf-0007-subprocess/76547/17

Just looked at the PR changes here again and wanted to emphasize again that I'm still not convinced we need this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal This PR is for a proposal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants