-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
process: make process.execve's args argument optional #58412
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
base: main
Are you sure you want to change the base?
Conversation
2cc96ea
to
0fdc896
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #58412 +/- ##
==========================================
- Coverage 90.21% 90.21% -0.01%
==========================================
Files 635 635
Lines 187174 187174
Branches 36747 36750 +3
==========================================
- Hits 168861 168857 -4
+ Misses 11103 11073 -30
- Partials 7210 7244 +34
🚀 New features to boost your workflow:
|
Can you please add a test? |
@lpinca I'm actually a bit lost as how we'd test this, and would appreciate a pointer. For a test without any args, the best I could think of is something down the lines of replacing the process with something known and just asserting the process was replaced: process.execve(
SOMETHING_GOES_HERE
);
// If process.execve succeed, this should never be executed.
fail('process.execve failed'); but I don't have a good idea for an executable that is :
The only two things I can think of that are known to be available is the node executable itself ( If you can help point me at the right direction, I'd be happy to add a test. FWIW, on my local env I tested this with |
What do think about finding the location first? Something like this const path = child_process.spawnSync('which', ['ls'], { encoding: 'utf8' }).stdout.trim(); |
0fdc896
to
8777409
Compare
@lpinca I was trying to avoid building a test that relies on I've added such a test, and rebased on top of the latest For the record - I'm using |
8777409
to
6139c81
Compare
This is embarrassing - my laptop is a mac, and the new test passes locally on it. On the CI env, macOS is the only thing that fails :-( |
6139c81
to
59b004a
Compare
Using |
@lpinca I'm not sure what exactly went wrong with using |
59b004a
to
3d51329
Compare
Failed to start CI⚠ Commits were pushed since the last approving review: ⚠ - process: make execve's args argument optional ✘ Refusing to run CI on potentially unsafe PRhttps://github.com/nodejs/node/actions/runs/15193843206 |
Align the code with the documentation and similar methods used to execute os commands - the `args` argument should be optional, and if omitted, treated as an empty array (`[]`). Fixes: nodejs#58411
3d51329
to
9694800
Compare
The external CI run for the previous iteration of the MR failed (@richardlau - thanks for triggering it!).
When using Instead of making assumptions about what binaries are available on every platform Node.js is built on and whether or not they allow Side note for clarification: |
@richardlau, apologies for nagging, but it looks like this PR lost its steam. I updated it to handle the (relevant) errors seen in the Jenkins CI, but IIUC, I can't re-trigger that run. |
I've retriggered the Jenkins CI. |
@richardlau Thanks! Looking at the failures, node-test-linux-alpine-last-latest-x64 fails on the startup time of node (see https://ci.nodejs.org/job/node-test-commit-linux/nodes=alpine-last-latest-x64/65075/testReport/junit/(root)/sequential/test_perf_hooks/) that probably isn't related to this MR (i.e., starting up node shouldn't call In the other two failed jobs, it shows that there are no tests. IIUC, these are just aggregate jobs, and the "real" failure is the aforementioned startup time failure. I'm not quite sure how to proceed from here, so any guidence would be appreciated. |
Following up on my prev comment - for the record, now the CI passes. I'm assuming this means the tests that failed aren't 100% stable, and as explained above, are probably unrelated to the PR's content. |
Align the code with the documentation and similar methods used to execute os commands - the
args
argument should be optional, and if omitted, treated as an empty array ([]
).Fixes: #58411