mirror of
https://github.com/morluto/rea.git
synced 2026-10-22 22:02:27 -05:00
fix(javascript): recover child-process options without args (#2781)
* docs: celebrate 180,000 GitHub stars 🎉 * fix(javascript): recover child-process options without args * fix(javascript): preserve execFile callback overload options Choose execFile options by the second argument object shape rather than total argument count, preserving callback overloads. Source inspection and git diff --check; tests/builds/typechecks/CI reruns skipped at explicit user request. --------- Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
This commit is contained in:
1 parent
fc0dbe7f9d
commit
c8e85b962a
3 files changed
+107
-5
No files matched your search
@@ -324,13 +324,18 @@ const resolveChildCandidates = (
|
||||
? []
|
||||
: (spawnsByBinding.get(binding.bindingId) ?? []);
|
||||
};
|
||||
|
||||
const spawnOptions = (candidate: SpawnCandidate): t.ObjectExpression | null => {
|
||||
const index = candidate.method === "exec" ? 1 : 2;
|
||||
const value = candidate.node.arguments[index];
|
||||
const args = candidate.node.arguments;
|
||||
|
||||
const value =
|
||||
candidate.method === "exec"
|
||||
? args[1]
|
||||
: t.isObjectExpression(args[1])
|
||||
? args[1]
|
||||
: args[2];
|
||||
|
||||
return t.isObjectExpression(value) ? value : null;
|
||||
};
|
||||
|
||||
const spawnArgvCount = (candidate: SpawnCandidate): number | null => {
|
||||
if (candidate.method === "exec") return null;
|
||||
const args = candidate.node.arguments[1];
|
||||
|
||||
Reference in new issue
Block a user