Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the stdio inherit option when executing the tool #54

Merged
merged 2 commits into from
Oct 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions packages/fta/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node

const { execSync } = require("node:child_process");
const { execSync, spawn } = require("node:child_process");
const path = require("node:path");
const fs = require("node:fs");

Expand Down Expand Up @@ -62,12 +62,13 @@ function runFta(project, options) {
// Run the binary directly if executed as a standalone script
// Arguments are directly forwarded to the binary
if (require.main === module) {
const args = process.argv.slice(2); // Exclude the first two arguments (node binary and script file)
const args = process.argv.slice(2); // Exclude the first two arguments (node binary and project path)
const binaryPath = getBinaryPath();
const binaryArgs = args.join(" ");
setUnixPerms(binaryPath);
const result = execSync(`${binaryPath} ${binaryArgs}`);
console.log(result.toString());

// Standard output will be printed due to use of `inherit`, i.e, no need to `console.log` anything
execSync(`${binaryPath} ${binaryArgs}`, { stdio: "inherit" });
}

module.exports.runFta = runFta;
Loading