Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat(#77): fakehub stop via cli::sys #192

Merged
merged 24 commits into from
Oct 9, 2024
Merged

feat(#77): fakehub stop via cli::sys #192

merged 24 commits into from
Oct 9, 2024

Conversation

h1alexbel
Copy link
Owner

@h1alexbel h1alexbel commented Oct 8, 2024

In this pull I've implemented fakehub stop command via system calls.

closes #77
History:


PR-Codex overview

This PR introduces a command to stop the fakehub server, adds system information logging, and enhances the CLI with new functionalities related to process management on UNIX systems. It also includes tests for OS detection and logging.

Detailed summary

  • Added Stop command in cli/src/args.rs.
  • Updated README.md with instructions to stop the server.
  • Introduced sys_info function in server/src/sys/sys_info.rs to log OS and PID.
  • Implemented current_port and kill_unix functions for managing server processes.
  • Created instance_os function to detect the operating system.
  • Added tests for instance_os and logging in sys_info.
  • Included MIT License headers in new files.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Copy link

codecov bot commented Oct 8, 2024

Codecov Report

Attention: Patch coverage is 13.15789% with 33 lines in your changes missing coverage. Please review.

Project coverage is 74.69%. Comparing base (59be07b) to head (6545435).
Report is 25 commits behind head on master.

Files with missing lines Patch % Lines
cli/src/main.rs 0.00% 14 Missing ⚠️
cli/src/sys/kill_unix.rs 0.00% 13 Missing ⚠️
cli/src/sys/current_port.rs 0.00% 5 Missing ⚠️
server/src/lib.rs 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #192      +/-   ##
==========================================
- Coverage   82.19%   74.69%   -7.50%     
==========================================
  Files          16       20       +4     
  Lines         292      328      +36     
==========================================
+ Hits          240      245       +5     
- Misses         52       83      +31     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@h1alexbel
Copy link
Owner Author

@rultor merge

@rultor
Copy link
Collaborator

rultor commented Oct 8, 2024

@rultor merge

@h1alexbel OK, I'll try to merge now. You can check the progress of the merge here.

@rultor
Copy link
Collaborator

rultor commented Oct 8, 2024

@rultor merge

@h1alexbel Oops, I failed. You can see the full log here (spent 12min).

   Compiling anstream v0.6.15
   Compiling chrono v0.4.38
   Compiling parameterized v2.0.0
   Compiling regex v1.11.0
   Compiling heck v0.5.0
   Compiling clap_lex v0.7.2
   Compiling strsim v0.11.1
   Compiling md5 v0.7.0
   Compiling clap_builder v4.5.20
   Compiling clap_derive v4.5.18
   Compiling clap v4.5.20
   Compiling fakehub-server v0.0.0 (/home/r/repo/server)
   Compiling syn v1.0.109
   Compiling predicates-core v1.0.8
   Compiling doc-comment v0.3.3
   Compiling overload v0.1.1
   Compiling nu-ansi-term v0.46.0
   Compiling clap_complete v4.5.33
   Compiling sharded-slab v0.1.7
   Compiling tracing-log v0.2.0
   Compiling thread_local v1.1.8
   Compiling termtree v0.4.1
   Compiling roff v0.2.2
   Compiling difflib v0.4.0
   Compiling assert_cmd v2.0.16
   Compiling predicates v3.1.2
   Compiling clap_mangen v0.2.24
   Compiling predicates-tree v1.0.11
   Compiling tracing-subscriber v0.3.18
   Compiling clap_complete_nushell v4.5.4
   Compiling tagrs v0.0.2
   Compiling bstr v1.10.0
   Compiling wait-timeout v0.2.0
   Compiling defer v0.2.1
   Compiling fakehub v0.0.0 (/home/r/repo/cli)
    Finished `test` profile [unoptimized + debuginfo] target(s) in 2m 40s
warning: the following packages contain code that will be rejected by a future version of Rust: num-bigint v0.1.44, num-complex v0.1.43, num-rational v0.1.42
note: to see what the problems were, use the option `--future-incompat-report`, or run `cargo report future-incompatibilities --id 1`
     Running unittests src/main.rs (target/debug/deps/fakehub-19e733ad15ba8689)

running 1 test
test sys::current_port::tests::returns_current_port_from_lsof ... \u001b[31mFAILED\u001b(B\u001b[m

failures:

---- sys::current_port::tests::returns_current_port_from_lsof stdout ----
thread 'sys::current_port::tests::returns_current_port_from_lsof' panicked at cli/src/sys/current_port.rs:34:10:
failed to convert port to usize: ParseIntError { kind: Empty }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    sys::current_port::tests::returns_current_port_from_lsof

test result: \u001b[31mFAILED\u001b(B\u001b[m. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.09s

error: test failed, to rerun pass `-p fakehub --bin fakehub`
\u001b[1;31merror\u001b[0m: \u001b[1mRecipe `rultor` failed on line 59 with exit code 101\u001b[0m
container 1757cc1ab2f3b8c4fa1cdcdf29b233a66b3325bef66127b3a9b98148b391915c is dead
Tue Oct  8 19:48:41 UTC 2024

@h1alexbel h1alexbel merged commit c513ad7 into master Oct 9, 2024
12 of 14 checks passed
@h1alexbel h1alexbel deleted the 77 branch October 9, 2024 08:23
@h1alexbel
Copy link
Owner Author

@rultor release, tag is 0.0.9

@rultor
Copy link
Collaborator

rultor commented Oct 9, 2024

@rultor release, tag is 0.0.9

@h1alexbel OK, I will release it now. Please check the progress here.

@rultor
Copy link
Collaborator

rultor commented Oct 9, 2024

@rultor release, tag is 0.0.9

@h1alexbel Done! FYI, the full log is here (took me 18min).

@0crat
Copy link

0crat commented Oct 9, 2024

@h1alexbel Thanks for your contribution! Here's how your +4 points were calculated: +4 base, -8 for exceeding 200 hits-of-code (363), -16 for no code review, -4 for only 4 comments, and +28 to meet the minimum reward. Remember, quality over quantity is key. Try to keep contributions smaller, ensure code reviews, and encourage more comments next time. Your current balance is +35. Keep up the good work! 💻

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

implement stop to shutdown fakehub server
3 participants