Jiahao XU
132c5dfaa9
Merge pull request #280 from cargo-bins/signal-handling
...
Add Signal handling
2022-08-06 20:13:03 +10:00
Jiahao XU
9cb8df1d48
Fix passing --quiet
to cargo-install
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-05 15:45:46 +10:00
Jiahao XU
c352eb00d1
Add missing doc for trace
for Options::log_level
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-05 15:24:39 +10:00
Jiahao XU
7a90d4d6c6
Improve help page for Options::log_level
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-05 15:09:40 +10:00
Jiahao XU
8d5f555373
Add new option -q
for compatibility with cargo-install
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-05 15:02:38 +10:00
Jiahao XU
b6a539735d
Pass -q
to cargo-install
if log_level
is set to off
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 23:21:29 +10:00
Jiahao XU
3d28549fd6
Apply clippy suggestions in binstall::install
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 23:18:00 +10:00
Jiahao XU
6685d5a610
Add new option Options::quiet
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 23:16:45 +10:00
Jiahao XU
62bce2f52f
Improve doc for Options::log_level
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 23:15:05 +10:00
Jiahao XU
ede134d851
Fix locking of stdou
in UIThreadInner
...
which blocks the printing in main thread and prevents it from exiting.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 23:04:04 +10:00
Jiahao XU
cea67b2e54
Use std:
🧵 :spawn in UIThreadInner
...
instead of `tokio::task::spawn_blocking` so that dropping rt would not
block the main thread until the ui thread is exit (which might never
exit).
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 23:01:26 +10:00
Jiahao XU
f4dd75ef9b
Update doc on BinstallError::UserAbort
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 19:44:12 +10:00
Jiahao XU
b921e9dfc8
Use cancel_on_user_sig_term
in main
...
to cancel the execution if users requested termination via signal.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 19:42:47 +10:00
Jiahao XU
47ab8f55c7
Impl new fn helpers::cancel_on_user_term
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 19:37:13 +10:00
Jiahao XU
e8301839a9
Use AutoAbortJoinHandle
in main::entry
...
so that the tasks will be cancelled if future returned by
`entry()` is cancelled.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 18:39:17 +10:00
Jiahao XU
a13180f79a
Ret BinstallError
in <AutoAbortJoinHandle as Future>::poll
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 18:37:52 +10:00
Jiahao XU
36066fd4df
Use AutoAbortJoinHandle::spawn
in GhCrateMeta::find
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 18:33:35 +10:00
Jiahao XU
5d315ae801
Use AutoAbortJoinHandle::spawn
in MultiFetcher::add
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 18:31:23 +10:00
Jiahao XU
2103dea3ac
Impl new convenient fn AutoAbortJoinHandle::spawn
...
As a shortcut to `AutoAbortJoinHandle::new(tokio::spawn(...))`
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 18:30:48 +10:00
Jiahao XU
d472e8054b
Fix typo in target::linux::create_targets_str
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 17:46:26 +10:00
Jiahao XU
a686aca08c
Refactor: Extract target::linux::create_targets_str
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 17:38:27 +10:00
Jiahao XU
7997c73cb2
Optimize: Avoid spawning ldd
if built with Glibc
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 17:35:24 +10:00
Jiahao XU
71566383db
Fix creating .cargo/.crates.toml
in metadata::v1
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 14:08:06 +10:00
Jiahao XU
28aeae938e
fs::create_dir_all(&install_path)
in main.rs
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-04 14:00:44 +10:00
Jiahao XU
346bb8ee67
Fix binstall::resolve
( #266 )
2022-08-04 11:12:06 +12:00
Jiahao XU
f7625fcefc
Merge pull request #264 from NobodyXu/fix-repeated-crates-on-batch-installation
...
Fix repeated crates on batch installation: Dedup them and only keep the last one
2022-08-03 21:32:09 +10:00
Jiahao XU
60d17c7e56
Ret CompactString
in Fetcher::source_name
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-02 22:42:05 +10:00
Jiahao XU
f72eafb049
Use PathBuf
for field Options::install_path
...
Since it does not require a utf-8 string.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-02 22:28:44 +10:00
Jiahao XU
a52ac3fc7a
Use CompactString
for Options::version_req
...
which is unlikely to be larger than 24 bytes.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-02 22:26:44 +10:00
Jiahao XU
b7cfa0aa64
Use CompactString
for field Resolution::Fetch::version
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-02 22:21:45 +10:00
Jiahao XU
d430c077d4
Use CompactString
for fields of CrateName
...
Since most of the time, they are shorter than 24 bytes.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-02 22:17:11 +10:00
Jiahao XU
caeb49ce33
Rm duplicate crate_names
specified on cmdline
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-02 22:15:09 +10:00
Jiahao XU
09c1afe616
Impl new fn CrateName::dedup
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-02 22:14:05 +10:00
Jiahao XU
9391d22fa2
Apply clippy suggestion
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-08-02 19:54:01 +10:00
Félix Saparelli
47fd7c14a6
Add -V, clean up errors and help text ( #259 )
...
Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-30 17:26:52 +12:00
Félix Saparelli
806f69832e
Place import at the top ( #258 )
2022-07-30 10:07:54 +12:00
Jiahao XU
0c761857be
Merge pull request #252 from NobodyXu/feature/binstall-format
...
Feature: Create metafile format for cargo-binstall
2022-07-29 00:47:30 +10:00
Jiahao XU
6c6d0fe9c2
Update logging for binstall_v1::append
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 23:15:26 +10:00
Jiahao XU
241b763477
Use CompactString
for field CrateVersionSource::name
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 23:14:00 +10:00
Jiahao XU
cb4cffd0ab
Fix confusing comment for field MetaData::other
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 20:33:24 +10:00
Jiahao XU
0d8b865ba4
Update binstall_v1::default_path
and fix typo in it
...
The postfix should be `.json`, not `.toml`.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 19:50:10 +10:00
Jiahao XU
c5db0fefb5
Use Vec
for field MetaData::other
...
by using `tuple_vec_map` to make the `Vec<(CompactString,
serde_json::Value)>` appears as a map.
This is OK because we don't access that part anyway and only add such
field to avoid losing any information when deserialize, modify it and
serialize it again to overwrite existing metafile.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 19:45:47 +10:00
Jiahao XU
98556cb2af
Add field MetaData::other
for forward compatibility
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 19:24:14 +10:00
Jiahao XU
00fb2528af
Rm unused import std::fs
in binstall_v1
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 18:09:53 +10:00
Jiahao XU
73af5b2824
Test appending behavior of append_to_path
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 18:09:38 +10:00
Jiahao XU
96d90c0376
Fix append_to_path
on windows: Use create_if_not_exist
...
to open the file.
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 18:06:39 +10:00
Jiahao XU
3f72e9b81a
Use tempfile::NamedTempFile
in unit test of binstall_v1
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 01:45:54 +10:00
Jiahao XU
3cd9866d32
Use unwrap
in unit test for binstall_v1
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-28 01:24:16 +10:00
Jiahao XU
2490c08840
Write to .binstall-crates.toml
in entry
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 23:15:54 +10:00
Jiahao XU
7ccbdb2356
Impl binstall_v1::append
...
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2022-07-27 23:15:46 +10:00