-
Notifications
You must be signed in to change notification settings - Fork 31.1k
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
src: add --run-from
runtime flag
#57523
base: main
Are you sure you want to change the base?
Conversation
Review requested:
|
The commit message doesn't adhere to our guidelines, it should start with an imperative verb so e.g. |
cc @flakey5 |
We need to also change the pull-request title and description to reflect the changes. |
The
notable-change
Please suggest a text for the release notes if you'd like to include a more detailed summary, then proceed to update the PR description with the text or a link to the notable change suggested text comment. Otherwise, the commit will be placed in the Other Notable Changes section. |
2b7efd1
to
75b88f0
Compare
--run-in
runtime flag--run-directory
runtime flag
--run-directory
runtime flag--run-in-directory
runtime flag
ddc39f0
to
8d8a3e5
Compare
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.
LGTM if tests pass (and the new requested test is added)
--run-in-directory
runtime flag--run-dir
runtime flag
I find the name node --run-path=./app/package.json --run test:backend
# Or
node --run-path=./app --run test:backend |
I understand your concern, I will wait for a few more ideas to make a collective decision, thank you very much for your suggestion 🙏 |
--run-dir
runtime flag--run-from
runtime flag
thanks a lot, now I am merging all commits and fixing my first commit message 🚀 |
What does it mean to apply only to |
f5f5cc7
to
bb2eaad
Compare
affcb49
to
4416cc0
Compare
only determines the directory where the --run command finds the package.json file; it does not change the process-wide working directory. |
Okay, can it accept as input either the path to the containing folder or the path directly to the (As in, if this isn't the current behavior is it possible to update the PR so that this is possible.) |
I'm not sure this feature will work as expected if it doesn't set the process's cwd. Most scripts I write wouldn't work FWIW |
yes, I'm trying now |
hello i sent an improvement @GeoffreyBooth @ovflowd @targos I tried to implement that if given a package.json directly, this directory is now selected as the parent directory |
Co-authored-by: Geoffrey Booth <webadmin@geoffreybooth.com>
Co-authored-by: Geoffrey Booth <webadmin@geoffreybooth.com>
I'm wondering how this can work in practice too. Does it solve #57489? Are the scripts in that |
@@ -206,7 +206,35 @@ void ProcessRunner::OnExit(int64_t exit_status, int term_signal) { | |||
|
|||
void ProcessRunner::Run() { | |||
// keeps the string alive until destructor | |||
cwd = package_json_path_.parent_path().string(); |
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.
This will not work since this doesn't add the current node_modules to path environment variable.
@mertcanaltin this is wrong. you're also changing the cwd of the process that we are spawning. To answer other reviewers: I think this solution has lots of flaws. It doesn't properly propagate path variable (according to the given --run-from), and makes lots of unnecessary system calls. |
now only the cwd of the spawned process (options_.cwd) is set, without changing the process-wide cwd. Also, if the file path is given for --run-from, the parent directory is used. I hope this addresses your concerns. |
// Adding node_modules/.bin under cwd to PATH environment variable | ||
std::filesystem::path nmBin = | ||
std::filesystem::path(cwd) / "node_modules" / ".bin"; | ||
if (std::filesystem::is_directory(nmBin)) { | ||
path_env_var_ = nmBin.string() + env_var_separator + path_env_var_; | ||
} |
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.
@anonrig I tried to process the path given with --run-from and add the node_modules/.bin
directory under the cwd to the PATH
Without changing the cwd of the parent process, only the cwd of the spawned process will be set, is this a good solution ?
add
--run-from
runtime flagFixes #57489