@llamaindex/semtools
Version:
Semantic search and document parsing tools for the command line (Rust-backed, npm-distributed)
20 lines (13 loc) • 590 B
JavaScript
const { spawn } = require('node:child_process');
const { join } = require('node:path');
const { existsSync } = require('node:fs');
const isWindows = process.platform === 'win32';
const exe = isWindows ? '.exe' : '';
const localPath = join(__dirname, '..', 'dist', 'bin', `workspace${exe}`);
const bin = existsSync(localPath) ? localPath : `workspace${exe}`;
const child = spawn(bin, process.argv.slice(2), { stdio: 'inherit', shell: isWindows });
child.on('exit', (code, signal) => {
if (signal) process.kill(process.pid, signal);
process.exit(code ?? 1);
});