UNPKG

@constructor-io/constructorio-connect-cli

Version:

CLI tool to enable users to interface with the Constructor Connect Ecosystem

28 lines (27 loc) 1 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isGitInstalled = isGitInstalled; const child_process_1 = require("child_process"); // const envWithoutGit = { ...process.env, PATH: "" }; // for manually triggering the error pass this in as the second argument to execSync /** * Check if Git is installed * * This function attempts to run the 'git --version' command. * It will return true if the command succeeds, indicating Git is installed. * It will return false if the command fails for any reason (including Git not being in PATH, * not installed, or any other error). * * This implementation works across different operating systems (Windows, macOS, Linux) * as it simply relies on the command execution succeeding or failing. * * @returns true if Git is installed, false otherwise */ function isGitInstalled() { try { (0, child_process_1.execSync)("git --version"); return true; } catch { return false; } }