Skip to content

Conversation

@cmcgee1024
Copy link
Member

@cmcgee1024 cmcgee1024 commented Aug 13, 2025

  • Remove the runProgram and runProgramOutput methods from Platform
  • Remove Configuration and other clones from an earlier version of Subprocess
  • ModeledCommandLine run() and output() methods use Subprocess
  • Provide an adapter for the Executable.path() that always takes SystemPackage.FilePath
  • Generate arguments separately from config generation to permit appending in subcommands
  • Make an AsyncSequence version of output() to allow in-stream processing of command outputs

if let env {
process.environment = env
}
// TODO: figure out how to set the process group
Copy link
Contributor

Choose a reason for hiding this comment

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

The PlatformOptions structure has some APIs you might be able to use for this.

I'm not that familiar with tcsetpgrp -- would setgid be sufficient here? (there's a PlatformOptions.processGroupID API for that)

Alternatively, there's a PlatformOptions.preSpawnProcessConfigurator closure on Linux/Android/BSD which runs between fork and exec, where you could do this. (But on Darwin, posix_spawn is used, and PlatformOptions.preSpawnProcessConfigurator runs before fork so I don't think you'd have a good place to do it)

Worth reaching out to @iCharlesHu to see if tcsetpgrp might be something worth having dedicated API for.

Copy link
Member Author

Choose a reason for hiding this comment

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

This was here because Foundation Process would automatically assign a new process group to child processes, and we wanted to be able to have the terminal control the child process that is in the foreground. With the default behaviour of swift-subprocess being that the child is in the current process's group this is no longer needed, which is a nice bonus of this new API.

@cmcgee1024 cmcgee1024 marked this pull request as ready for review November 1, 2025 12:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants