diff options
author | Rory Dudley | 2024-02-27 03:49:01 -0700 |
---|---|---|
committer | Rory Dudley | 2024-02-27 03:49:01 -0700 |
commit | e94d09da9449cabd7ece2acd98d52b1946a922a4 (patch) | |
tree | f0fb980662c01bf0c37bc2cfe30dcc5f7952f869 /Cargo.lock | |
parent | 0548e74cb3227716cf445f27bd64b8c0b4d0f981 (diff) | |
download | dwarvish-e94d09da9449cabd7ece2acd98d52b1946a922a4.tar.gz |
Remove custom errors and fix background forking
Removes the custom errors in src/recite/erro.rs, and replaces them with
std::io::Errors throughout (recite(), incant_, macros).
Fixed a bug with the way forking to the background is handled, where
registering the signal handler in main for all processes would break
couplets (i.e. pipes). Instead, this sets up a new signal handler each
time a process is forked into the background. It uses a Vec<i32> to keep
track of all the background processes.
Notes
Notes:
First off, there is some defunct code in the main repl loop, which is an
example of killing zombie processes after each prompt. This should be
removed, but I kept it in, just in case I go back to it for some reason.
To be honest, I have no clue why this code works. In theory, I should
have to remove the pid from the pids: Vec<i32> if waitpid returns a
positive integer. However, when I tried this, it completely broke the
program. ¯\_(ツ)_/¯
Also, it's worth noting that registering a signal handler with
signal_hook::low_level::register, is somewhat costly, according to their
docs. Given that this only occurs for background processes that are
forked, however, I think it is acceptable.
Finally, we never unregister the signal handler, so I'm not sure if
that's still hanging out in memory somewhere or no.
Diffstat (limited to 'Cargo.lock')
-rw-r--r-- | Cargo.lock | 56 |
1 files changed, 0 insertions, 56 deletions
@@ -8,7 +8,6 @@ version = "0.0.0" dependencies = [ "libc", "signal-hook", - "thiserror", ] [[package]] @@ -18,24 +17,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] -name = "proc-macro2" -version = "1.0.78" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" -dependencies = [ - "proc-macro2", -] - -[[package]] name = "signal-hook" version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -53,40 +34,3 @@ checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" dependencies = [ "libc", ] - -[[package]] -name = "syn" -version = "2.0.51" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ab617d94515e94ae53b8406c628598680aa0c9587474ecbe58188f7b345d66c" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "thiserror" -version = "1.0.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" |