Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
).then(() => {
if (shouldBuildAll) {
const archs = ['x64']
const platforms = ['linux', 'win32', 'darwin']
platforms.forEach((plat) => {
archs.forEach((arch) => {
pack(plat, arch, log(plat, arch))
})
})
} else {
// build for current platform only
pack(os.platform(), os.arch(), log(os.platform(), os.arch()))
}
}).catch((error) => {
console.log('Error:', JSON.stringify(error, null, 2))
.then(paths => {
if (shouldBuildAll) {
// build for all platforms
const archs = ['ia32', 'x64'];
const platforms = ['linux', 'win32', 'darwin'];
platforms.forEach(plat => {
archs.forEach(arch => {
pack(plat, arch, log(plat, arch));
});
});
} else {
// build for current platform only
pack(os.platform(), os.arch(), log(os.platform(), os.arch()));
}
})
.catch(err => {
function bitness () {
if (os.arch() === 'x64') {
return 'x64';
}
else {
// avoid "ia32" result on windows
return 'x86';
}
}
import * as toolLib from 'azure-pipelines-tool-lib/tool';
import * as tl from 'azure-pipelines-task-lib/task';
import * as path from 'path';
import * as util from 'util';
import * as os from 'os';
const osPlat: string = os.platform();
let osArch: string = tl.getInput('architecture', false);
if (!osArch) {
osArch = os.arch();
}
if (osArch != 'x64' && osArch != 'x32') {
throw new Error('Invalid architecture ' + osArch);
}
export async function getGo(version: string) {
// check cache
let toolPath: string;
toolPath = toolLib.findLocalTool('go', normalizeVersion(version));
if (!toolPath) {
// download, extract, cache
toolPath = await acquireGo(version);
tl.debug("Go tool is cached under " + toolPath);
}
let ffmpegPath;
let ffmpegVersion;
if (process.pkg && process.pkg.entrypoint) {
dirName = path.dirname(process.execPath);
} else {
dirName = process.cwd();
}
switch (os.platform()) {
case 'win32':
osType = `Windows_${os.arch()}`;
ffmpegLocalPath = path.resolve(`${dirName}/ffmpeg.exe`);
break;
case 'linux':
osType = `Linux_${os.arch()}`;
ffmpegLocalPath = path.resolve(`${dirName}/ffmpeg`);
break;
case 'darwin':
osType = `macOS_${os.arch()}`;
ffmpegLocalPath = path.resolve(`${dirName}/ffmpeg`);
break;
default :
throw new Error('unable to determine operating system');
}
if (fs.existsSync(ffmpegLocalPath)) {
try {
fs.accessSync(ffmpegLocalPath, fs.constants.X_OK);
ffmpegPath = ffmpegLocalPath;
} catch (err) {
console.error(err.message);
function isMacBook() {
return os.arch() === 'x64' ? true : false
}
function findAllVersions(toolName, arch) {
const versions = [];
arch = arch || os.arch();
const toolPath = path.join(cacheRoot, toolName);
if (fs.existsSync(toolPath)) {
const children = fs.readdirSync(toolPath);
for (const child of children) {
if (_isExplicitVersion(child)) {
const fullPath = path.join(toolPath, child, arch || '');
if (fs.existsSync(fullPath) && fs.existsSync(`${fullPath}.complete`)) {
versions.push(child);
}
}
}
}
return versions;
}
exports.findAllVersions = findAllVersions;
fs.readFile(pendingUpdatePath, {encoding: 'utf8'}, function (err, updateContents) {
var updatePending = !err && updateContents === 'PENDING'
var updateInProgress = !err && updateContents === 'INPROGRESS'
var ctx = {
name: name,
version: version,
publisher: publisher,
channel: channel,
dev: dev,
platform: os.platform(),
arch: os.arch(),
configuration: dev ? 'debug' : 'release',
updatePending: updatePending,
updateInProgress: updateInProgress,
registry: registry,
appDir: appDir,
dependencies: package.dependencies || {},
plugins: package.plugins || {}
}
callback(null, ctx)
})
})
let config_promise = new Promise((resolve, reject) => {
let config = {
release: app.getVersion(),
environment: is.dev() ? 'development' : 'production',
name: osName(),
tags: {
os_arch: os.arch(),
os_platform: os.platform(),
os_release: os.release(),
os_version: process.getSystemVersion(),
os_type: os.type(),
os_totalmem: os_totalmem_gb + 'GB',
hostname: app.config.get('host'),
user_style: app.config.get('acceptUserStyles'),
user_script: app.config.get('acceptUserScripts'),
tray: app.config.get('tray'),
menu_bar: app.config.get('menu-bar')
},
dataCallback: (data) => {
if (user) {
data.user = {
id: user.id,
name: user.name,
const getArch = () => {
let arch = os.arch() == ('x32' || 'ia32') ? 'x86' : 'x64';
if (process.env.APPVEYOR) {
arch = process.env.PLATFORM === 'x86' ? 'x86' : 'x64';
}
return arch;
};