function start () { // Only one app per app in osx... const shouldQuit = app.makeSingleInstance(() => { if (mainWindow) { mainWindow.show(true) mainWindow.window.focus() } }) if (shouldQuit) { console.log('Only one instance of keybase GUI allowed, bailing!') app.quit() return } // Check supported OS version if (os.platform() === 'darwin') { // Release numbers for OS versions can be looked up here: https://en.wikipedia.org/wiki/Darwin_%28operating_system%29#Release_history // 14.0.0 == 10.10.0 // 15.0.0 == 10.11.0 if (!semver.satisfies(os.release(), '>=14.0.0')) { dialog.showErrorBox('Keybase Error', 'This version of OS X isn\'t currently supported.') app.quit() return } } process.on('uncaughtException', e => { console.log('Uncaught exception on main thread:', e) }) // MUST do this else we get limited by simultaneous hot reload event streams app.commandLine.appendSwitch('ignore-connections-limit', 'localhost') if (__DEV__) { // eslint-disable-line no-undef app.commandLine.appendSwitch('enable-logging') app.commandLine.appendSwitch('v', 3) } hello(process.pid, 'Main Thread', process.argv, __VERSION__) // eslint-disable-line no-undef consoleHelper() ipcLogs() devTools() menuBar() urlHelper() kbfsHelper() ListenLogUi() windowHelper(app) installer(err => { if (err) { console.log('Error: ', err) } splash() }) app.once('ready', () => { mainWindow = MainWindow() storeHelper(mainWindow) if (!mainWindow.initiallyVisible) { hideDockIcon() } }) // Called when the user clicks the dock icon app.on('activate', () => { mainWindow.show(true) }) // Don't quit the app, instead try to close all windows app.on('close-windows', event => { const windows = BrowserWindow.getAllWindows() windows.forEach(w => { // We tell it to close, we can register handlers for the 'close' event if we want to // keep this window alive or hide it instead. w.close() }) }) app.on('before-quit', event => { const windows = BrowserWindow.getAllWindows() windows.forEach(w => { w.destroy() }) }) // quit through dock. only listen once app.once('before-quit', event => { console.log('Quit through before-quit') event.preventDefault() executeActionsForContext('beforeQuit') }) }
/** * Outputs environment details at the top of the log file * for each run of `titanium build` * @param {Object} cli - The CLI instance * * See http://en.wikipedia.org/wiki/Darwin_%28operating_system%29#Release_history for * os.release() to version mapping for OS X. (e.g. 14.0.0 is v10.10 Yosemite) */ function logBanner(cli) { var os = require('os'); return new Date().toLocaleString() + '\n\n' + 'Build Environment \n' + ' Host OS = ' + (os.platform()==='darwin' ? "OS X" : os.platform()) + ' ' + os.release() + ', ' + os.arch() + '\n' + ' Target platform = ' + ti.resolvePlatform(cli.argv.platform) + '\n' + ' CLI version = ' + cli.version + '\n' + ' SDK version = ' + cli.argv.sdk + '\n' + ' SDK path = ' + cli.sdk.path + '\n' + ' Node version = ' + process.version + '\n' + ' Command = ' + cli.argv.$ + ' ' + cli.argv.$_.join(' ') + '\n' + '\n'; }
'use strict'; var os = require('os'); var url = require('url'); var request = require('request'); var ResourceError = require('../error/ResourceError'); var authc = require('../authc'); var packageJson = require('../../package.json'); var utils = require('../utils'); var USER_AGENT_VALUE = 'stormpath-sdk-node/' + packageJson.version + ' node/' + process.versions.node + ' ' + os.platform() + '/' + os.release(); /** * * @param {object} options * @constructor */ function RequestExecutor(options) { options = options || {}; this.baseUrl = options.baseUrl || 'https://api.stormpath.com/v1'; this.requestAuthenticator = authc.getAuthenticator(options); options.headers = options.headers || {}; options.json = true; this.options = options;
function supportsColor(stream) { if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false')) { return 0; } if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) { return 3; } if (hasFlag('color=256')) { return 2; } if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) { return 1; } if (stream && !stream.isTTY) { return 0; } if (process.platform === 'win32') { // Node.js 7.5.0 is the first version of Node.js to include a patch to // libuv that enables 256 color output on Windows. Anything earlier and it // won't work. However, here we target Node.js 8 at minimum as it is an LTS // release, and Node.js 7 is not. Windows 10 build 10586 is the first Windows // release that supports 256 colors. Windows 10 build 14931 is the first release // that supports 16m/TrueColor. const osRelease = os.release().split('.'); if ( Number(process.versions.node.split('.')[0]) >= 8 && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586 ) { return Number(osRelease[2]) >= 14931 ? 3 : 2; } return 1; } if ('CI' in env) { if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(sign => sign in env) || env.CI_NAME === 'codeship') { return 1; } return 0; } if ('TEAMCITY_VERSION' in env) { return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0; } if ('TERM_PROGRAM' in env) { const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); switch (env.TERM_PROGRAM) { case 'iTerm.app': return version >= 3 ? 3 : 2; case 'Hyper': return 3; case 'Apple_Terminal': return 2; // No default } } if (/-256(color)?$/i.test(env.TERM)) { return 2; } if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { return 1; } if ('COLORTERM' in env) { return 1; } if (env.TERM === 'dumb') { return 0; } return 0; }
this.After(function(scenario) { sandbox.restore(); scenario.attach('Operating System Platform: ' + os.platform(), 'text/plain'); scenario.attach('Operating System Release Version ' + os.release(), 'text/plain'); });
var os = require('os'); var obj = {}; obj.arch = os.arch(); obj.cpus = os.cpus(); obj.endianness = os.endianness(); obj.freemem = os.freemem(); obj.hostname = os.hostname(); obj.loadavg = os.loadavg(); obj.networkInterfaces = os.networkInterfaces(); obj.platform = os.platform(); obj.release = os.release(); obj.tmpdir = os.tmpdir(); obj.totalmem = os.totalmem(); obj.type = os.type(); obj.uptime = os.uptime(); console.log(obj);
var version = process.versions.node.split('.'); if (version[1] <= 8 && version[2] <= 5) badVersion = true; } return badVersion && os.arch() === 'x64' && os.type() === 'SunOS'; } /** * Settings actually get scraped below. */ // in 64-bit SmartOS zones, node <= 0.8.5 pukes on os.cpus() if (!badOS()) addSetting('Processors', os.cpus().length); addSetting('OS', os.type()); addSetting('OS version', os.release()); addSetting('Node.js version', process.version); addSetting('Architecture', process.arch); remapConfigSettings(); findPackages(); module.exports = { toJSON : function () { return settings; }, setFramework : function (framework) { addSetting("Framework", framework); }, setDispatcher : function (dispatcher) { addSetting("Dispatcher", dispatcher); }, get : getSetting };
//Returns the hostname of the operating system as a string. console.log("os.hostname()",os.hostname()); //Returns an array containing the 1, 5, and 15 minute load averages. console.log("os.loadavg()",os.loadavg()); //Returns an object containing only network interfaces that have been assigned a network address. console.log("os.networkInterfaces()",os.networkInterfaces()); //Returns a string identifying the operating system platform as set during compile time of Node.js. //'aix' 'darwin' 'freebsd' 'linux' 'openbsd' 'sunos' 'win32' 'android' console.log("os.platform()",os.platform()); //Returns a string identifying the operating system release. console.log("os.release()",os.release()); //Returns a string specifying the operating system's default directory for temporary files. console.log("os.tmpdir()",os.tmpdir()); //Returns the total amount of system memory in bytes as an integer. console.log("os.totalmem()",os.totalmem()); //Returns a string identifying the operating system //'Linux' on Linux, 'Darwin' on macOS and 'Windows_NT' on Windows. console.log("os.type()",os.type()); //Returns the system uptime in number of seconds. console.log("os.uptime()",os.uptime()); //Returns information about the currently effective user
function errorHandler (er) { log.disableProgress() if (!npm.config || !npm.config.loaded) { // logging won't work unless we pretend that it's ready er = er || new Error('Exit prior to config file resolving.') console.error(er.stack || er.message) } if (cbCalled) { er = er || new Error('Callback called more than once.') } cbCalled = true if (!er) return exit(0) if (typeof er === 'string') { log.error('', er) return exit(1, true) } else if (!(er instanceof Error)) { log.error('weird error', er) return exit(1, true) } var m = er.code || er.message.match(/^(?:Error: )?(E[A-Z]+)/) if (m && !er.code) { er.code = m } ;[ 'type', 'fstream_path', 'fstream_unc_path', 'fstream_type', 'fstream_class', 'fstream_finish_call', 'fstream_linkpath', 'stack', 'fstream_stack', 'statusCode', 'pkgid' ].forEach(function (k) { var v = er[k] if (!v) return if (k === 'fstream_stack') v = v.join('\n') log.verbose(k, v) }) log.verbose('cwd', process.cwd()) var os = require('os') log.verbose('', os.type() + ' ' + os.release()) log.verbose('argv', process.argv.map(JSON.stringify).join(' ')) log.verbose('node', process.version) log.verbose('npm ', 'v' + npm.version) ;[ 'file', 'path', 'code', 'errno', 'syscall' ].forEach(function (k) { var v = er[k] if (v) log.error(k, v) }) var msg = errorMessage(er) msg.summary.concat(msg.detail).forEach(function (errline) { log.error.apply(log, errline) }) if (npm.config.get('json')) { var error = { error: { code: er.code, summary: messageText(msg.summary), detail: messageText(msg.detail) } } console.log(JSON.stringify(error, null, 2)) } exit(typeof er.errno === 'number' ? er.errno : 1) }
track(name, data) { if (!name) { return; } const payload = data || {}; if (localStorage.getItem('metrics.enabled') !== 'true') { return; } let id = localStorage.getItem('metrics.id'); if (!id) { id = uuid.v4(); localStorage.setItem('metrics.id', id); } const osName = os.platform(); const osVersion = util.isWindows() ? os.release() : osxRelease(os.release()).version; mixpanel.track(name, assign({ distinct_id: id, version: util.packagejson().version, 'Operating System': osName, 'Operating System Version': osVersion, 'Operating System Architecture': os.arch() }, payload)); }, };
var os = require('os'); console.log('TempDir:\t ' + os.tmpdir() ); console.log('endianness: \t' + os.endianness); console.log('hostname: \t'+ os.hostname()); console.log('type: \t\t'+ os.type()); console.log('platform: \t' + os.platform()); console.log('arch: \t\t'+ os.arch()); console.log('release: \t'+ os.release()); console.log('uptime: \t'+ os.uptime()); console.log('loadavg: \t'+ os.loadavg()); console.log('totalmem: \t' + os.totalmem()); console.log('freemem: \t'+ os.freemem()); console.log('EOL: \t'+ os.EOL); console.log('Cpus: \t\t:' + JSON.stringify(os.cpus())); console.log("networkInterfaces: " + JSON.stringify(os.networkInterfaces()));
}).then(() => { if (log.isEnabledFor(log.VERBOSE)) { Promise.longStackTraces(); } log.info('Versions OS: %s sitespeed.io: %s browsertime: %s coach: %s', os.platform() + ' ' + os.release(), packageInfo.version, packageInfo.dependencies.browsertime, packageInfo.dependencies.webcoach); }).then((pluginNames) => {
export function getOsVersion(): string { return os.release(); }
if (STUDENT_IDS.length) { log("Will test only for student ids " + STUDENT_IDS); } log("******************* Starting homework #" + HOMEWORK_NUMBER + " *******************"); var SOLUTIONS_FOLDER = './data/' + HOMEWORK_NUMBER; var walk = require('walk'); //**************************************************************************************************************** //this will be used to invoke a compiler //if you don't have clang++, you wil have to modify that var COMPILER_START_COMMAND = 'clang++ -Xclang -std=c++14 -O3 -stdlib=libc++ -I/Developer/git/GPAPI/GPAPI/HPC2015/ -fno-vectorize -lstdc++ -lpthread -march=native'; var USE_SANDBOXING = (os.platform()=="darwin") && parseFloat(os.release()) >= 15; checkUserDirExists("./data"); checkUserDirExists(SOLUTIONS_FOLDER); if (USE_SANDBOXING) { log("Sandboxing is supported and will be used"); } else { log("WARNING! Sandboxing is not supported and will be disabled"); } //the folder that holds the homeworks for all students //it should be located in the folder from which this file is started //if it not exists there, it will be created. In this folder the script will create a folder for each student id. //In each student id folders, there will be a file named 'sandbox', that has the sandbox configuration for that folder and a folder for each homework. //In each homework folder, there will be a HOMEWORK_EXECUTABLE_NAME.cpp file (containing the source), HOMEWORK_EXECUTABLE_NAME.bin (containing the executable) and results.txt (containing part of the log that this scripts prints).
.on('request', function (request, response){ // Ability to chain calls var writeHead = response.writeHead; response.writeHead = function (){ writeHead.apply(this, arguments); return this; }; var request_url = url.parse(request.url, true/*???*/); switch(request_url.pathname){ case '/': response .writeHead(200, {'Content-type': 'text/html'}) .end(["<html><head><title>Hello, world!</title></head>", "<body><h1>Hello, world!</h1>", "<p><a href='/osinfo'>OS Info</a></p>", "</body></html>"].join('\n')); break; case '/osinfo': response .writeHead(200, {'Content-type':'text/html'}) .end(["<html><head>", "<title>Operating System Info</title></head>", "<body><h1>Operating System Info</h1>", "<table>", "<tr><th>TMP Dir</th><td>{tmpdir}</td></tr>", "<tr><th>Host Name</th><td>{hostname}</td></tr>", "<tr><th>OS Type</th>", "<td>{type} {osplat} {osarch} {osrelease}</td></tr>", "<tr><th>Uptime</th>", " <td>{uptime} {loadavg}</td></tr>", "<tr><th>Memory</th>", " <td>total: {totalmem} free:{freemem}</td></tr>", "<tr><th>CPU's</th>", " <td><pre>{cpudata}</pre></td></tr>", "<tr><th>Network</th>", " <td><pre>{netdata}</pre></td></tr>", "</table>", "</body></html>"] .join('\n') .replace("{tmpdir}", os.tmpDir()) .replace("{hostname}", os.hostname()) .replace("{type}", os.type()) .replace("{osplat}", os.platform()) .replace("{osarch}", os.arch()) .replace("{osrelease}", os.release()) .replace("{uptime}", os.uptime()) .replace("{loadavg}", util.inspect(os.loadavg())) .replace("{totalmem}", os.totalmem()) .replace("{freemem}", os.freemem()) .replace("{cpudata}", util.inspect(os.cpus())) .replace("{netdata}", util.inspect(os.networkInterfaces())) // ); // break; default: // error console.log("HOLA"); response .writeHead(404, {'Content-type': 'text/plain'}) .end("bad URL "+request.url); // break; } })
function walkThroughSchedule() { var schedule = JSON.parse(localStorage.schedule || '{}'); var today = new Date(); var nowTime = Date.now(); // once every day send analytics daily hit var todayDate = today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + today.getDate(); if (todayDate !== schedule.lastAnalyticsDailyHit) { analytics.dailyHit(); schedule.lastAnalyticsDailyHit = todayDate; } // once every month send reaport about basic usage informations if (!schedule.nextAnalyticsMonthlyReaport) { // first reaport in 7 days schedule.nextAnalyticsMonthlyReaport = nowTime + daysToMs(7); } else if (schedule.nextAnalyticsMonthlyReaport <= nowTime) { analytics.monthlyReaport({ feedsCount: feedsService.feeds.length, categoriesCount: feedsService.categoriesNames.length, tagsCount: articlesService.allTags.length, articlesDbSize: articlesService.dbSize, platform: config.targetPlatform + '|' + os.platform() + '|' + os.type() + '|' + os.release(), windowSize: win.width + 'x' + win.height }); schedule.nextAnalyticsMonthlyReaport = nowTime + daysToMs(30); } // check for new version every 7 days if (!schedule.nextCheckForUpdates || schedule.nextCheckForUpdates <= nowTime) { schedule.nextCheckForUpdates = nowTime + daysToMs(7); checkForUpdates(); } // update all feeds' favicons every 7 days if (!schedule.nextFaviconUpdate || schedule.nextFaviconUpdate <= nowTime) { faviconsService.updateMany(feedsService.feeds); schedule.nextFaviconUpdate = nowTime + daysToMs(7); } // perform database compaction every 7 days if (!schedule.nextDatabaseCompaction || schedule.nextDatabaseCompaction <= nowTime) { // assume month is 31 days var olderThan = nowTime - (config.keepArticlesForMonths * 31 * 24 * 60 * 60 * 1000); articlesService.removeOlderThan(olderThan, config.keepTaggedArticlesForever) .then(function (numRemoved) { // done }); schedule.nextDatabaseCompaction = nowTime + daysToMs(3); } // save changed schedule after every run localStorage.schedule = JSON.stringify(schedule); }
function Node () { this.info = { name: INSTANCE_NAME || (process.env.EC2_INSTANCE_ID || os.hostname()), contact: (process.env.CONTACT_DETAILS || ""), coinbase: null, node: null, net: null, protocol: null, api: null, port: (process.env.LISTENING_PORT || 30303), os: os.platform(), os_v: os.release(), client: pjson.version, canUpdateHistory: true, }; this.id = _.camelCase(this.info.name); this.stats = { active: false, mining: false, hashrate: 0, peers: 0, pending: 0, gasPrice: 0, block: { number: 0, hash: '?', difficulty: 0, totalDifficulty: 0, transactions: [], uncles: [] }, syncing: false, uptime: 0 }; this._lastBlock = 0; this._lastStats = JSON.stringify(this.stats); this._lastFetch = 0; this._lastPending = 0; this._tries = 0; this._down = 0; this._lastSent = 0; this._latency = 0; this._web3 = false; this._socket = false; this._latestQueue = null; this.pendingFilter = false; this.chainFilter = false; this.updateInterval = false; this.pingInterval = false; this.connectionInterval = false; this._lastBlockSentAt = 0; this._lastChainLog = 0; this._lastPendingLog = 0; this._chainDebouncer = 0; this._chan_min_time = 50; this._max_chain_debouncer = 20; this._chain_debouncer_cnt = 0; this._connection_attempts = 0; this._timeOffset = null; this.startWeb3Connection(); return this; }
db.query('select version() as v', function(err, rows) { res.json({status: 1, info: {serverIP: serverIP, serverVersion: os.release(), clientIP: clientIP, clientVersion: req.headers['user-agent'], dbVersion: rows[0]['v']} }); });
function buildActionSoapRequest(service, actionName, argObj){ /* sample request: POST path control URL HTTP/1.0 HOST: hostname:portNumber CONTENT-LENGTH: bytes in body CONTENT-TYPE: text/xml; charset="utf-8" USER-AGENT: OS/version UPnP/1.1 product/version SOAPACTION: "urn:schemas-upnp-org:service:serviceType:v#actionName" <?xml version="1.0"?> <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <s:Body> <u:actionName xmlns:u="urn:schemas-upnp-org:service:serviceType:v"> <argumentName>in arg value</argumentName> <!-- other in args and their values go here, if any --> </u:actionName> </s:Body> </s:Envelope> */ var d = Q.defer(); // Create a new xml parser with an array of xml elements to look for //var parser = new xml2object([ 'Envelope' ], undefined, {xmlns:true}); var parser = new xml2object([ 'Body' ], undefined, {xmlns:true}); // Bind to the object event to work with the objects found in the XML file parser.on('object', function(name, obj) { // looking for only 1 object (Body) for both success and error messages if(obj.Fault){ d.reject(new UPnPError(obj.Fault.detail.UPnPError)); }else{ //TODO handle state vars updating? d.resolve(obj); } }); // Bind to the file end event to tell when the file is done being streamed parser.on('end', function() { console.log('Finished parsing xml!'); }); console.log('creating http request'); // handle bad URLs try{ var req = http.request( { method: 'POST', /* hostname: '127.0.0.1', //path: '/test/echo.php', //path: '/test/upnpServiceActionResponse.php', path: '/test/upnpServiceActionResponse_error.php', /*/ path: service.controlUrl, //*/ headers: { 'CONTENT-TYPE': 'text/xml; charset="utf-8"', 'SOAPACTION' : '"urn:schemas-upnp-org:service:'+service.type+'#'+actionName+'"', 'USER-AGENT': os.platform()+'/'+os.release() + ' UPnP/1.1 ' + pkgJson.name+'/'+pkgJson.version //TODO get version from package.json file } }, function(response){ console.log('got serviceUrl response', response.statusCode); //TODO parse XML fun! response.pipe(parser.saxStream); } ); req.on('error', function(err){ console.error('error in http request'); d.reject(err); }); console.log('writing out to request'); //TODO each req.write is a chunk, while efficient if streaming data, if we have it all here it's likely just harder on the endpoint req.write('<?xml version="1.0"?>'); req.write('<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">'); req.write( '<Body>'); req.write( '<'+actionName+' xmlns="urn:schemas-upnp-org:service:'+service.type+'">'); Object.keys(argObj).forEach(function(argName){ req.write( '<'+argName+'>'+argObj[argName]+'</'+argName+'>'); }); req.write( '</'+actionName+'>'); req.write( '</Body>'); req.write('</Envelope>'); req.end(); // we don't need to keep the stream open longer than the parser needs }catch(e){ console.error('couldnt make request', e); //callback.call(self, e); returnPromise.reject(e); } return d.promise; }
/** * Returns all browser names found on the current system. * * @param {!Object} browsers The object with all browsers fro the browsers directory. * @returns {Array} */ function getInstalledBrowsers (browsers) { var i, length, browserNames = Object.keys(browsers), result = []; // iterate over all browsers in the browsers folder for (i = 0, length = browserNames.length; i < length; i++) { var browser = browsers[browserNames[i]], browserPaths = browser.DEFAULT_CMD[process.platform] || [], y, paths = browserPaths.length; // iterate over all browser paths for (y = 0; y < paths; y++) { try { var browserLocated = fs.existsSync(browserPaths[y]) || process.env[browser.ENV_CMD] || which.sync(browserPaths[y]); // don't use Edge on operating systems other than Windows 10 // (the launcher would be found, but would fail to run) var useBrowser = browser.name !== 'Edge' || process.platform === 'win32' && /^1\d/.test(os.release()); if (browserLocated && useBrowser) { // add browser when found in file system or when env variable is set result.push(browser.name); // set env variable on win32 when it does not exist yet if (process.platform === 'win32' && !process.env[browser.ENV_CMD]) { process.env[browser.ENV_CMD] = browserPaths[y]; } break; } } catch (e) { // which.sync() failed to find the browser. } } } return result; }
var isGalileo = (function() { var release = os.release(); return release.includes("yocto") || release.includes("edison"); })();
function errorHandler (er) { var printStack = false // console.error("errorHandler", er) if (!npm.config.loaded) { // logging won't work unless we pretend that it's ready er = er || new Error("Exit prior to config file resolving.") console.error(er.stack || er.message) } if (cbCalled) { er = er || new Error("Callback called more than once.") } cbCalled = true if (!er) return exit(0) if (typeof er === "string") { log.error("", er) return exit(1, true) } else if (!(er instanceof Error)) { log.error("weird error", er) return exit(1, true) } var m = er.code || er.message.match(/^(?:Error: )?(E[A-Z]+)/) if (m && !er.code) er.code = m switch (er.code) { case "ECONNREFUSED": log.error("", er) log.error("", ["\nIf you are behind a proxy, please make sure that the" ,"'proxy' config is set properly. See: 'npm help config'" ].join("\n")) printStack = true break case "EACCES": case "EPERM": log.error("", er) log.error("", ["\nPlease try running this command again as root/Administrator." ].join("\n")) printStack = true break case "ELIFECYCLE": er.code = "ELIFECYCLE" log.error("", er.message) log.error("", ["","Failed at the "+er.pkgid+" "+er.stage+" script." ,"This is most likely a problem with the "+er.pkgname+" package," ,"not with npm itself." ,"Tell the author that this fails on your system:" ," "+er.script ,"You can get their info via:" ," npm owner ls "+er.pkgname ,"There is likely additional logging output above." ].join("\n")) break case "EJSONPARSE": er.code = "EJSONPARSE" log.error("", er.message) log.error("", "File: "+er.file) log.error("", ["Failed to parse package.json data." ,"package.json must be actual JSON, not just JavaScript." ,"","This is not a bug in npm." ,"Tell the package author to fix their package.json file." ].join("\n"), "JSON.parse") break case "E404": er.code = "E404" if (er.pkgid && er.pkgid !== "-") { var msg = ["'"+er.pkgid+"' is not in the npm registry." ,"You should bug the author to publish it"] if (er.pkgid.match(/^node[\.\-]|[\.\-]js$/)) { var s = er.pkgid.replace(/^node[\.\-]|[\.\-]js$/g, "") if (s !== er.pkgid) { s = s.replace(/[^a-z0-9]/g, ' ') msg.push("\nMaybe try 'npm search " + s + "'") } } msg.push("\nNote that you can also install from a" ,"tarball, folder, or http url, or git url.") log.error("404", msg.join("\n")) } break case "EPUBLISHCONFLICT": er.code = "EPUBLISHCONFLICT" log.error("publish fail", ["Cannot publish over existing version." ,"Bump the 'version' field, set the --force flag, or" ," npm unpublish '"+er.pkgid+"'" ,"and try again" ].join("\n")) break case "EISGIT": er.code = "EISGIT" log.error("git", [er.message ," "+er.path ,"Refusing to remove it. Update manually," ,"or move it out of the way first." ].join("\n")) break case "ECYCLE": er.code = "ECYCLE" log.error("cycle", [er.message ,"While installing: "+er.pkgid ,"Found a pathological dependency case that npm cannot solve." ,"Please report this to the package author." ].join("\n")) break case "EBADPLATFORM": er.code = "EBADPLATFORM" log.error("notsup", [er.message ,"Not compatible with your operating system or architecture: "+er.pkgid ,"Valid OS: "+er.os.join(",") ,"Valid Arch: "+er.cpu.join(",") ,"Actual OS: "+process.platform ,"Actual Arch: "+process.arch ].join("\n")) break case "EEXIST": log.error([er.message ,"File exists: "+er.path ,"Move it away, and try again."].join("\n")) break case "ENEEDAUTH": log.error("need auth", [er.message ,"You need to authorize this machine using `npm adduser`" ].join("\n")) break case "ENOTSUP": if (er.required) { log.error("notsup", [er.message ,"Not compatible with your version of node/npm: "+er.pkgid ,"Required: "+JSON.stringify(er.required) ,"Actual: " +JSON.stringify({npm:npm.version ,node:npm.config.get("node-version")}) ].join("\n")) break } // else passthrough default: log.error("", er.stack || er.message || er) log.error("", ["If you need help, you may report this log at:" ," <http://github.com/isaacs/npm/issues>" ,"or email it to:" ," <*****@*****.**>" ].join("\n")) printStack = false break } var os = require("os") // just a line break console.error("") log.error("System", os.type() + " " + os.release()) log.error("command", process.argv .map(JSON.stringify).join(" ")) log.error("cwd", process.cwd()) log.error("node -v", process.version) log.error("npm -v", npm.version) ; [ "file" , "path" , "type" , "syscall" , "fstream_path" , "fstream_unc_path" , "fstream_type" , "fstream_class" , "fstream_finish_call" , "fstream_linkpath" , "code" , "errno" , "stack" , "fstream_stack" ].forEach(function (k) { var v = er[k] if (k === "stack") { if (!printStack) return if (!v) v = er.message } if (!v) return if (k === "fstream_stack") v = v.join("\n") log.error(k, v) }) exit(typeof er.errno === "number" ? er.errno : 1) }
"use babel"; const path = require('path'); const os = require('os'); const electron = require('electron'); function requireAtomCoreModule(name) { return require(path.join(atom.packages.resourcePath, 'src', name)); } const Pane = requireAtomCoreModule('pane'); const PaneAxis = requireAtomCoreModule('pane-axis'); const TextEditorComponent = requireAtomCoreModule('text-editor-component'); if (os.platform() == 'win32' && os.release().startsWith('10.')) { // currently `transparent` isnt supported on win10 document.body.style.backgroundColor = "#000"; } let cursorBlinkInterval = 1000; function setCursorBlinkInterval(editor) { let editorView = atom.views.getView(editor); if(!editorView.component){ return; } let editorComponent = editorView.component; editorComponent.stopCursorBlinking(true); editorComponent.props.cursorBlinkPeriod = cursorBlinkInterval; editorComponent.startCursorBlinking(); } atom.workspace.observeTextEditors(setCursorBlinkInterval);
if( typeof __isNewInstall != 'undefined' && __isNewInstall == true ) { userTracking.event('App Install', getOperatingSystem().capitalize(), Settings.get('version')).send(); } else if( typeof __isUpgradeInstall != 'undefined' && __isUpgradeInstall == true ) { userTracking.event('App Upgrade', getOperatingSystem().capitalize(), Settings.get('version')).send(); } // Todo: Remove Upgrade in the next version to prevent double counting of device stats (we'd send stats once per version) if( (typeof __isNewInstall != 'undefined' && __isNewInstall == true) || (typeof __isUpgradeInstall != 'undefined' && __isUpgradeInstall == true) ) { // General Device Stats userTracking.event('Device Stats', 'Version', Settings.get('version') + (isDebug ? '-debug' : '') ).send(); userTracking.event('Device Stats', 'Type', getOperatingSystem().capitalize()).send(); userTracking.event('Device Stats', 'Operating System', os.type() +' '+ os.release()).send(); userTracking.event('Device Stats', 'CPU', os.cpus()[0].model +' @ '+ (os.cpus()[0].speed/1000).toFixed(1) +'GHz' +' x '+ os.cpus().length ).send(); userTracking.event('Device Stats', 'RAM', Math.round(os.totalmem() / 1024 / 1024 / 1024)+'GB' ).send(); userTracking.event('Device Stats', 'Uptime', Math.round(os.uptime() / 60 / 60)+'hs' ).send(); // Screen resolution, depth and pixel ratio (retina displays) if( typeof screen.width == 'number' && typeof screen.height == 'number' ) { var resolution = (screen.width).toString() +'x'+ (screen.height.toString()); if( typeof screen.pixelDepth == 'number' ) { resolution += '@'+ (screen.pixelDepth).toString(); } if( typeof window.devicePixelRatio == 'number' ) { resolution += '#'+ (window.devicePixelRatio).toString(); } userTracking.event('Device Stats', 'Resolution', resolution).send(); }
console.log('hostname = %s', hostname); assert.ok(hostname.length > 0); var uptime = os.uptime(); console.log('uptime = %d', uptime); assert.ok(uptime > 0); var cpus = os.cpus(); console.log('cpus = ', cpus); assert.ok(cpus.length > 0); var type = os.type(); console.log('type = ', type); assert.ok(type.length > 0); var release = os.release(); console.log('release = ', release); assert.ok(release.length > 0); var platform = os.platform(); console.log('platform = ', platform); assert.ok(platform.length > 0); var arch = os.arch(); console.log('arch = ', arch); assert.ok(arch.length > 0); if (process.platform != 'sunos') { // not implemeneted yet assert.ok(os.loadavg().length > 0); assert.ok(os.freemem() > 0);
set:function(e) { var os = require('os'); var version = parseInt(os.release().substring(0,os.release().indexOf('.'))); if(version < 14) return; this.native('setTitleVisibility', e ? $.NSWindowTitleVisible : $.NSWindowTitleHidden ); }
log('sentry disabled (dev mode)'); } else if (!trackAnalytics) { log('sentry disabled (analytics disabled)'); } else { log('setting up sentry'); client = require(process.type + '/services/sentry').getClient(); client.setUserContext({ uid: getUserId() }); client.setExtraContext({ portable: global.manifest.portable, buildNum: global.manifest.buildNum, os_release: os.release(), versions: { electron: global.manifest.electronVersion, app: global.manifest.version }, prefs: prefs.getAll() }); client.setTagsContext({ process_type: 'renderer', distrib: global.manifest.distrib, os_platform: os.platform() }); } export default client;
exports.index = function(){ var config = cfg.get(); console.log("Your System is:",os.type(),os.platform(),os.release(),os.arch()); /* if( 'darwin' == os.platform() ){ console.log("Using OSX"); if( 'x64' == os.arch() ){ console.log("64Bit Arch"); Ffmpeg.setFfmpegPath(__dirname + '/ffmpeg/ffmpeg-osx64/ffmpeg'); Ffmpeg.setFfprobePath(__dirname + '/ffmpeg/ffmpeg-osx64/ffprobe'); Ffmpeg.setFlvtoolPath('/usr/bin/flvtool2'); } }else if( 'windows' == os.platform() ){ if( 'x64' == os.arch() ){ console.log("64Bit Arch"); Ffmpeg.setFfmpegPath('./ffmpeg/ffmpeg-win64/bin/ffmpeg.exe'); Ffmpeg.setFfprobePath('./ffmpeg/ffmpeg-win64/bin/ffprobe.exe'); Ffmpeg.setFlvtoolPath('./ffmpeg/ffmpeg-win64/bin/flvtool2.exe'); } } */ /* * For debug and testing Ffmpeg.getAvailableFormats(function(err, formats) { console.log('Available formats:'); console.dir(formats); }); Ffmpeg.getAvailableCodecs(function(err, codecs) { console.log('Available codecs:'); console.dir(codecs); }); Ffmpeg().getAvailableEncoders(function(err, encoders) { console.log('Available encoders:'); console.dir(encoders); }); Ffmpeg.getAvailableFilters(function(err, filters) { console.log("Available filters:"); console.dir(filters); }); */ if(dd.type(config.media,'object') && dd.type(config.media.paths,'array')){ console.log("Search our defined paths"); config.media.paths.forEach( function(_path){ console.log("Path:",_path); fs.exists(_path,function(exists){ if(exists){ pathRead(_path); }else{ console.log("Path does not exists! '"+_path+"'"); } //should we add fs watchers to these dirs? }); } ); }else{ console.log("No paths defined",dd.type(config.media)); process.exit(1); } };
var os = require('os'); var message ='Here is some info about your system'; var sysarray = new Array('Type: '+os.type(), 'Node Version: '+process.version, 'Platform: '+os.platform(), 'Hostname: '+os.hostname(), 'Total Memory: '+os.totalmem(), 'Free Memory: '+os.freemem(), 'Uptime: '+os.uptime(), 'Cpus: '+os.cpus(), 'Process.arch: '+os.arch(), 'HomDir: '+os.homedir(), 'Loadavg: '+os.loadavg(), 'Network: '+os.networkInterfaces(), 'Relesae: '+os.release(), 'Type: '+os.type(), 'Uptime: '+os.uptime(), 'Endianness of the CPU: '+os.endianness() ); console.log(message); var arraylen = sysarray.length; i = 0; while(i < arraylen){ console.log(sysarray[i]); i++; }
function setMeta() { var id = 'system.host.' + firstIp; var obj = { _id: id, type: 'host', common: {}, native: { process: { title: process.title, pid: process.pid, versions: process.versions, env: process.env }, os: { hostname: os.hostname(), type: os.type(), platform: os.platform(), arch: os.arch(), release: os.release(), uptime: os.uptime(), endianness: os.endianness(), tmpdir: os.tmpdir() }, hardware: { cpus: os.cpus(), totalmem: Math.floor(os.totalmem() / 1024 / 1024), networkInterfaces: os.networkInterfaces() } } }; objects.setObject(id, obj); var idMem = id + ".mem"; var obj = { _id: idMem, type: 'state', parent: id, common: { type: 'number', name: 'Memory usage', unit: '%', min: 0, max: 100 }, native: {} }; objects.setObject(idMem, obj); var idLoad = id + ".load"; var obj = { _id: idLoad, type: 'state', parent: id, common: { unit: '', type: 'number', name: 'Load Average 1min' }, native: {} }; objects.setObject(idLoad, obj); var idAlive = id + ".alive"; var obj = { _id: idAlive, type: 'state', parent: id, common: { name: 'Host alive', type: 'boolean' }, native: {} }; objects.setObject(idAlive, obj); }