-
Notifications
You must be signed in to change notification settings - Fork 94
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adex tool was introduced #1729
adex tool was introduced #1729
Conversation
…m2 and atomic swap protocol
@shamardy @ozkanonur @borngraced |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great implementation :)
I have a few suggestions/notes from my first review iteration:
…-adex # Conflicts: # Cargo.lock # mm2src/common/Cargo.toml
…-adex # Conflicts: # CHANGELOG.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
I have a few comments/questions for my first review :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! I have couple questions and some questions
Yes, I mentioned exactly these differences, nothing else. Sorry, maybe I wasn't so clear. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems you are missed / did not pay attention to few recommendations in #1729 (review) , related to the "Matching with Fork::Parent
should not be considered as a successful launch".
Let's imagine the following case:
mm2
binary exists, but we accidentally didchmod -x mm2
on it.- After
./adex-cli start
user will see the following message:
Successfully started: "mm2", forked pid: 579956
thread 'main' panicked at 'Failed to execute process: Os { code: 13, kind: PermissionDenied, message: "Permission denied" }', src/scenarios/mm2_proc_mng.rs:117:30
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Errors and reports about a successful start at the same time mislead.
In all other aspects it looks good to me.
You just have avoid writing |
Sure, I know, thank you ) |
done cc: @ozkanonur P.S: if I used something like this the output would make the output messy if let Ok(Fork::Child) = daemon(true, true) {
command.output().expect("Failed to start: {program:?}");
exit(1);
};
info!("Successfully started: {program:?}"); |
Found more deliberate decision using fork and setsid together instead of daemon. Works well, no ugly things in source code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The look of it has improved, but there is still a potential for a report of a “successful start” even if the outcome was a failure:
- Let's imagine user already have started instance of
mm2
from some other folder. - In folder with
adex-cli
he havemm2
file without rights on execution (chmod -x mm2
). - After
./adex-cli start
user will see the messageSuccessfully started: "mm2"
, but in real - nothing is started.
Also, can you explain why you chose to use fork()
to launch the mm2
, rather than simple spawn new process and "detach"? What was your thought process behind this decision? Just curious to know.
use std::process::Command;
let child_process = Command::new("my_child_process_binary")
.args(&["arg1", "arg2"])
.spawn()
.expect("Failed to start child process");
// detach the child process
let pid = child_process.id();
std::mem::forget(child_process);
println!("Started child process with PID {}", pid);
@DeckerSU, to tell you the truth, using |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fixes @rozhkovdmitrii! Changes since my last review looks good.
adex-cli command line utility was introduced that supplies commands: init, start, stop, status #1729 CI/CD workflow logics are improved #1736 Project root is simplified/refactored #1738 Created base image to provide more glibc compatible pre-built binaries for linux #1741 Set default log level as "info" #1747
DO NOT FORGET TO SQUASH COMMITTS ON MERGE
adex
command line utility was introduced that suppliesCommands:
init
,start
,stop
,status