First upload version 0.0.1

This commit is contained in:
Neyra
2026-02-05 15:27:49 +08:00
commit 8e9b7201ed
4182 changed files with 593136 additions and 0 deletions

53
node_modules/cmake-js/lib/processHelpers.js generated vendored Normal file
View File

@@ -0,0 +1,53 @@
'use strict'
const spawn = require('child_process').spawn
const execFile = require('child_process').execFile
const processHelpers = {
run: function (command, options) {
if (!options) options = {}
return new Promise(function (resolve, reject) {
const env = Object.assign({}, process.env)
if (env.Path && env.PATH) {
if (env.Path !== env.PATH) {
env.PATH = env.Path + ';' + env.PATH
}
delete env.Path
}
const child = spawn(command[0], command.slice(1), {
stdio: options.silent ? 'ignore' : 'inherit',
env,
})
let ended = false
child.on('error', function (e) {
if (!ended) {
reject(e)
ended = true
}
})
child.on('exit', function (code, signal) {
if (!ended) {
if (code === 0) {
resolve()
} else {
reject(new Error('Process terminated: ' + code || signal))
}
ended = true
}
})
})
},
execFile: function (command) {
return new Promise(function (resolve, reject) {
execFile(command[0], command.slice(1), function (err, stdout, stderr) {
if (err) {
reject(new Error(err.message + '\n' + (stdout || stderr)))
} else {
resolve(stdout)
}
})
})
},
}
module.exports = processHelpers