fix unlink

This commit is contained in:
2023-12-11 13:51:21 +01:00
parent 6a282f039d
commit 40c5e5abb4
3 changed files with 5 additions and 5 deletions

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "@ershisan99/go-npm", "name": "@ershisan99/go-npm",
"version": "0.1.13", "version": "0.1.14",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@ershisan99/go-npm", "name": "@ershisan99/go-npm",
"version": "0.1.13", "version": "0.1.14",
"license": "Apache-2.0", "license": "Apache-2.0",
"bin": { "bin": {
"go-npm": "bin/index.js" "go-npm": "bin/index.js"

View File

@@ -1,6 +1,6 @@
{ {
"name": "@ershisan99/go-npm", "name": "@ershisan99/go-npm",
"version": "0.1.13", "version": "0.1.14",
"description": "Distribute and install Go binaries via NPM", "description": "Distribute and install Go binaries via NPM",
"main": "index.js", "main": "index.js",
"bin": { "bin": {

View File

@@ -1,5 +1,5 @@
const { join } = require('path'); const { join } = require('path');
const { chmodSync, copyFileSync, existsSync, unlink } = require('fs'); const { chmodSync, copyFileSync, existsSync, unlinkSync } = require('fs');
const { getInstallationPath } = require('../common'); const { getInstallationPath } = require('../common');
function verifyAndPlaceBinary(binName, binPath, callback) { function verifyAndPlaceBinary(binName, binPath, callback) {
@@ -14,7 +14,7 @@ function verifyAndPlaceBinary(binName, binPath, callback) {
// Move the binary file and make sure it is executable // Move the binary file and make sure it is executable
copyFileSync(join(binPath, binName), join(installationPath, binName)); copyFileSync(join(binPath, binName), join(installationPath, binName));
unlink(join(binPath, binName)); unlinkSync(join(binPath, binName));
chmodSync(join(installationPath, binName), '755'); chmodSync(join(installationPath, binName), '755');
console.log('Placed binary on', join(installationPath, binName)); console.log('Placed binary on', join(installationPath, binName));