Live data from Hacker News

Fixing Ctrl+C in Rust terminal apps: Child process management

fiveonefour.com

11–20 of 62 posts

Re: Fixing Ctrl+C in Rust terminal apps: Child process management

#11

Nothing here is specific to Rust and applies to any terminal app in any language that spawns a child process.

Nothing, that is, except for the examples, the source code, the libraries, and the linked references. But nothing else.

Re: Fixing Ctrl+C in Rust terminal apps: Child process management

#15

This title was close to being a garden path sentence, but ultimately avoided it.

Yes, daemonized children must always be killed; preferably by the parent, but any reaper would also work.

Is that a forking path sentence? If so, whoosh.

Re: Fixing Ctrl+C in Rust terminal apps: Child process management

#16
post #12

Fearless concurrency with Rust unless you are worried about lifecycle management, threads/co-operation and general ergonomics. Even modern c++ might be better at this (gasp!) with std::jthread

I believe Rust's std::thread::scope is an equivalent.

> Unlike non-scoped threads, scoped threads can borrow non-'static data, as the scope guarantees all threads will be joined at the end of the scope.

> All threads spawned within the scope that haven’t been manually joined will be automatically joined before this function returns.

Re: Fixing Ctrl+C in Rust terminal apps: Child process management

#17
post #11

Nothing here is specific to Rust and applies to any terminal app in any language that spawns a child process.

Nothing, that is, except for the examples, the source code, the libraries, and the linked references. But nothing else.

Are you suggesting that the examples, source, libraries, and references for Rust make these mistakes, but other languages don't?

Re: Fixing Ctrl+C in Rust terminal apps: Child process management

#18
post #12

Fearless concurrency with Rust unless you are worried about lifecycle management, threads/co-operation and general ergonomics. Even modern c++ might be better at this (gasp!) with std::jthread

Are there any languages that provide for or care about lifecycle management across address space boundaries? After fork() you're usually fucked and need explicit controls.

Re: Fixing Ctrl+C in Rust terminal apps: Child process management

#19
post #12

Fearless concurrency with Rust unless you are worried about lifecycle management, threads/co-operation and general ergonomics. Even modern c++ might be better at this (gasp!) with std::jthread

Yes, and if you update to a version of LLVM that was released literally a week ago, jthread exists.
Post reply on HN