Skip to content

Use Process.exec in shards run#686

Merged
straight-shoota merged 8 commits intocrystal-lang:masterfrom
straight-shoota:feat/shards-run-exec
Dec 17, 2025
Merged

Use Process.exec in shards run#686
straight-shoota merged 8 commits intocrystal-lang:masterfrom
straight-shoota:feat/shards-run-exec

Conversation

@straight-shoota
Copy link
Member

@straight-shoota straight-shoota commented Aug 19, 2025

Use Process.exec on Unix systems to replace the current process.
This doesn't work on Windows (crystal-lang/crystal#14422), so we use Process.run instead, plus exit(Process::Status) on Crystal 1.19 (crystal-lang/crystal#16436) or a fallback (exit status.system_exit_status.to_i32!) on older versions.

Resolves #685

@beta-ziliani
Copy link
Member

Just noting that tests are failing

@straight-shoota
Copy link
Member Author

We're stopping execution of the current program with exec directly after emitting the last log message. Because of that, the async log dispatcher doesn't run anymore and the message never gets written.

For now I'm adding a patch to explicitly close the log backend, which flushes all pending message.

But this seems like a general problem that should be addressed in the Crystal repo.

@straight-shoota
Copy link
Member Author

The failure on Windows is due to crystal-lang/crystal#14422
So apparently we cannot use Process.exec on Windows just now.

@straight-shoota
Copy link
Member Author

This is ready for another review. We're using Process.exec on Unix systems and Process.run on Windows, plus exit(Process::Status) on Crystal 1.19 (crystal-lang/crystal#16436) or a fallback (exit status.system_exit_status.to_i32!) on older versions.

@ysbaddaden ysbaddaden added this to the 0.20.0 milestone Dec 16, 2025
@straight-shoota straight-shoota merged commit 5354629 into crystal-lang:master Dec 17, 2025
9 checks passed
@straight-shoota straight-shoota deleted the feat/shards-run-exec branch December 17, 2025 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

shards run cannot handle all exit statuses

5 participants