Skip to content

Add callCreateProcess#358

Merged
tomjaguarpaw merged 19 commits intohaskell:masterfrom
sol:dry
Apr 18, 2026
Merged

Add callCreateProcess#358
tomjaguarpaw merged 19 commits intohaskell:masterfrom
sol:dry

Conversation

@sol
Copy link
Copy Markdown
Member

@sol sol commented Apr 14, 2026

  • analog to readCreateProcess
  • this also removes code duplication between callProcess and callCommand

Comment thread System/Process.hs
case exit_code of
ExitSuccess -> return ()
ExitFailure r -> processFailedException "callProcess" cmd args r
callProcess cmd = callCreateProcess_ "callProcess" . proc cmd
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Technically I would be in favor of:

  1. Implementing this in terms of callCreateProcess
  2. get rid of callCreateProcess_
  3. state in the documentation that this is an alias for callCreateProcess (proc cmd args)

However, technically that is a breaking change, as it will change error messages. Not sure how big of an issue that is, but when readCreateProcess was introduced back in 2015 error messages did change, so there is some precedence at least.

From a users perspective, you don't really want a whole bunch of different functions that are all slightly different and are implemented in terms of internal primitives. What you want is:

  1. General functions that are flexible
  2. Specialized functions that are implemented in terms of those more general functions

Sadly, process is very far from this ideal.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

And presumably for callCommand too?

I don't really have an objection to this. It makes a lot of sense and I personally don't feel strongly about just the function name changing in the error message.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks like we need spawnCreateProcess too!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

For the latter see #360

@sol sol force-pushed the dry branch 2 times, most recently from 485d512 to c341f96 Compare April 15, 2026 02:28
@tomjaguarpaw
Copy link
Copy Markdown
Member

Thanks, this is very nice. I took the liberty of breaking into tiny commits so I could see what was going on.

@tomjaguarpaw
Copy link
Copy Markdown
Member

There are failures only on old GHCs on MacOS. At some point I might dig into why, but they shouldn't block this PR.

@tomjaguarpaw tomjaguarpaw merged commit 7ca603d into haskell:master Apr 18, 2026
32 of 36 checks passed
This was referenced Apr 18, 2026
@tomjaguarpaw
Copy link
Copy Markdown
Member

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