mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Another iteration
This commit is contained in:
parent
f400c5576a
commit
28d24bb6ea
12 changed files with 134 additions and 107 deletions
|
|
@ -1,22 +1,25 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
|
||||
import { initializePackageManager } from "../src/packagemanager/currentPackageManager.js";
|
||||
import { setCurrentPipInvocation, PIP_INVOCATIONS, PIP_PACKAGE_MANAGER } from "../src/packagemanager/pip/pipSettings.js";
|
||||
import { setEcoSystem, ECOSYSTEM_PY } from "../src/config/settings.js";
|
||||
import { main } from "../src/main.js";
|
||||
|
||||
const argv = process.argv.slice(2);
|
||||
// Set eco system
|
||||
setEcoSystem(ECOSYSTEM_PY);
|
||||
|
||||
const supportedArgs = ["pip", "pip3"];
|
||||
|
||||
if (argv[0] === "-m" && argv[1] && supportedArgs.includes(argv[1])) {
|
||||
// Strip '-m pip' or '-m pip3' from args if present
|
||||
let argv = process.argv.slice(2);
|
||||
if (argv[0] === '-m' && argv[1] === 'pip') {
|
||||
setEcoSystem(ECOSYSTEM_PY);
|
||||
|
||||
initializePackageManager(argv[1]);
|
||||
var exitCode = await main(argv.slice(2));
|
||||
process.exit(exitCode);
|
||||
setCurrentPipInvocation(PIP_INVOCATIONS.PY_PIP);
|
||||
initializePackageManager(PIP_PACKAGE_MANAGER);
|
||||
argv = argv.slice(2);
|
||||
var exitCode = await main(argv);
|
||||
process.exit(exitCode);
|
||||
} else {
|
||||
// Fallback: run the real python
|
||||
const { spawn } = await import("child_process");
|
||||
spawn("python", argv, { stdio: "inherit" });
|
||||
// Forward to real python binary for non-pip flows
|
||||
const { spawn } = await import('child_process');
|
||||
spawn('python', argv, { stdio: 'inherit' });
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue