taplo/scripts/utils.mjs
Jakub Panek 9acabdf72e
Clean-up deps, fix vscode ext, refactor linter (#697)
* replace `atty` with std::io::IsTerminal; MSRV 1.70

* Hide linter behind feature, enabled by default

- make `lint` subcommand a feature-gated, enabled
  by default; only available to build, it will not
  be distributed by default, if it introduces a
  regression, it will be reverted; closes #694

- clean-up code a bit, make `lsp` subcommand fail
  properly as no subcommand found since the errors
  are swallowed somewhere before reaching stderr

- remove references to `reqwest::Url`, use
  `url::Url` exclusively

* update rustls

* update wasm-bindgen

* update indexmap

* fix wasm panic in vscode extension
2024-11-04 17:25:08 +01:00

33 lines
596 B
JavaScript

#!/usr/bin/env node
import { rmSync } from "node:fs";
import { spawn } from "node:child_process";
function exec(argv0, argv) {
const proc = spawn(argv0, argv, {
stdio: ["ignore", "inherit", "inherit"],
shell: true,
});
proc.on("close", (code) => {
if (code != 0) {
console.error(`exit code: ${code}`);
}
});
}
function unlink(path) {
try {
rmSync(path, { recursive: true, force: true });
} catch (e) {
switch (e.code) {
case "ENOENT":
break;
default:
console.error(e);
break;
}
}
}
export { exec, unlink };