Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Refactor CLI to use spawn for better signal handling in watch mode#7844

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nojaf merged 2 commits intorescript-lang:masterfromnojaf:better-exit-handling
Sep 5, 2025

Conversation

@nojaf
Copy link
Member

@nojafnojaf commentedSep 5, 2025
edited
Loading

Replaced execFileSync with spawn to prevent blocking the event loop, allowing for proper signal forwarding and cleanup on termination. This change enhances the user experience during watch mode by ensuring that the Rust watcher can exit cleanly and that the parent process does not terminate prematurely. Added signal handling for SIGINT, SIGTERM, SIGHUP, and SIGQUIT to manage child process termination effectively.

This is to prevent the terminal being blocked after sendingctrl + c during watch mode.

Kapture 2025-09-05 at 17 16 14

Problem goes away after this PR:

Kapture 2025-09-05 at 17 17 55

@pkg-pr-new
Copy link

pkg-pr-newbot commentedSep 5, 2025
edited
Loading

Open in StackBlitz

rescript

npm i https://pkg.pr.new/rescript-lang/rescript@7844

@rescript/darwin-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-arm64@7844

@rescript/darwin-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/darwin-x64@7844

@rescript/linux-arm64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-arm64@7844

@rescript/linux-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/linux-x64@7844

@rescript/runtime

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/runtime@7844

@rescript/win32-x64

npm i https://pkg.pr.new/rescript-lang/rescript/@rescript/win32-x64@7844

commit:ba50294

@nojafnojaf marked this pull request as ready for reviewSeptember 5, 2025 15:39
@nojaf
Copy link
MemberAuthor

Worked on Windows as well.

@zthzth requested a review fromcknittSeptember 5, 2025 15:55
@zth
Copy link
Member

zth commentedSep 5, 2025

👍 from me, great stuff! But would be good if@cknitt had a look.

nojaf reacted with thumbs up emoji

@cknitt
Copy link
Member

Thanks! I wonder if this logic shouldn't be extracted to some helper function and used in other places, too, like bsc.js or in the rescript legacy code.

Actually we already havelib_dev/process.js with similar utility functions, so it could go there.

@nojaf
Copy link
MemberAuthor

Hmm, I'm not sure really, I’d prefer keeping this in the CLI runtime rather than lib_dev/process.js (which is dev/test-only and has different behavior).

bsc.js runs a single-shot compiler invocation without a watch loop. There’s no long-lived child to gracefully tear down on Ctrl+C, so execFileSync is appropriate and simpler. The problem we fixed only shows up in rescript.js because rewatch runs indefinitely and needs orderly signal forwarding/cleanup.

The user problem is with rescript.js, fixing it there seems fine to me.

@nojafnojaf merged commit535a8bd intorescript-lang:masterSep 5, 2025
25 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fhammerschmidtfhammerschmidtfhammerschmidt approved these changes

@cknittcknittAwaiting requested review from cknitt

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@nojaf@zth@cknitt@fhammerschmidt

[8]ページ先頭

©2009-2025 Movatter.jp