commands: create a dedicated commands directory

This commit is contained in:
2024-06-17 15:22:36 +08:00
parent fb6a75cb27
commit ca6dafa5f9
6 changed files with 248 additions and 151 deletions

View File

@@ -1,10 +1,9 @@
import child_process from "child_process"
import { PlatformPath } from "path"
import path from "path"
// FIXME: these imports basically looks ugly.
import { LLVM_EXTRACT, PREFIX, SYSROOT_PREFIX, FLANG } from "./environment";
import { CompilerCommands } from "./commands";
import { ExtractOptions, extractCommand } from "./commands/compiler";
/**
@@ -36,10 +35,10 @@ export function functionList(module: string) {
/**
* Extract one function using llvm-extract
*/
export async function extract(options: CompilerCommands.ExtractOptions) {
export async function extract(options: ExtractOptions) {
let process = child_process.spawn(
LLVM_EXTRACT,
CompilerCommands.extractCommand(options),
extractCommand(options),
{ stdio: "inherit" }
)
const exitcode = await new Promise((resolve, reject) => { process.on('close', resolve) })