opendraft 1.4.4 → 1.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/opendraft.js +23 -1
- package/package.json +1 -1
package/bin/opendraft.js
CHANGED
|
@@ -104,7 +104,29 @@ function installOpendraft(pythonCmd) {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
function runOpendraft(pythonCmd, args) {
|
|
107
|
-
|
|
107
|
+
// Try running the opendraft command directly first (installed by pip)
|
|
108
|
+
try {
|
|
109
|
+
execSync('which opendraft', { encoding: 'utf8', stdio: 'pipe' });
|
|
110
|
+
const proc = spawn('opendraft', args, {
|
|
111
|
+
stdio: 'inherit',
|
|
112
|
+
env: process.env
|
|
113
|
+
});
|
|
114
|
+
proc.on('close', (code) => {
|
|
115
|
+
process.exit(code);
|
|
116
|
+
});
|
|
117
|
+
return;
|
|
118
|
+
} catch (e) {
|
|
119
|
+
// opendraft not in PATH, run via Python
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Fallback: run via Python with proper argument handling
|
|
123
|
+
const script = `
|
|
124
|
+
import sys
|
|
125
|
+
sys.argv = ['opendraft'] + ${JSON.stringify(args)}
|
|
126
|
+
from opendraft.cli import main
|
|
127
|
+
main()
|
|
128
|
+
`;
|
|
129
|
+
const proc = spawn(pythonCmd, ['-c', script], {
|
|
108
130
|
stdio: 'inherit',
|
|
109
131
|
env: process.env
|
|
110
132
|
});
|