function getLine() { let e = new Error(); // now magic will happen: get line number from callstack if (process.platform === 'win32') { return e.stack.split('\n')[3].split(':')[2]; } return e.stack.split('\n')[3].split(':')[1]; }
/** * get information of operating-system * * @param {Function} callback * @api public */ export function getSysInfo(callback: Function): void { if (process.platform === 'win32') return; let reData: any = getBasicInfo(); exec('iostat ', function (err, output) { if (!!err) { console.error('getSysInfo failed! ' + err.stack); callback(err, reData); } else { reData.iostat = format(output); callback(null, reData); } }); }
/** * get the process information by command 'ps auxw | grep serverId | grep pid' * * @param {Object} param * @param {Function} callback * @api public */ export function getPsInfo(param: PsParam, callback: Function): void { if (process.platform === 'win32') return; let pid = param.pid; let cmd = 'ps auxw | grep ' + pid + ' | grep -v \'grep\''; // let cmd = "ps auxw | grep -E '.+?\\s+" + pid + "\\s+'" ; exec(cmd, function (err: any, output) { if (!!err) { if (err.code === 1) { console.log('the content is null!'); } else { console.error('getPsInfo failed! ' + err.stack); } callback(err, null); return; } format(param, output, callback); }); }
function positionWin() { let Positioner = require("electron-positioner"); let positioner = new Positioner(miniPlayerWindow); let pos = (process.platform === "win32") ? "bottomRight" : "topRight"; positioner.move(pos); }
it('after kill() all tmp file should be removed', async function () { const runner = await launchWithHeadless(); const chromeDataDir = runner.chromeDataDir; assert.notEqual(runner.chromeProcess, null); await runner.kill(); // TODO windows removed tmp dir failed if (process.platform !== 'win32') { assert.equal(fs.existsSync(chromeDataDir), false, `tmp dir ${chromeDataDir} should be removed`); } });
// Quit when all windows are closed. app.on('window-all-closed', function () { // On macOS it is common for applications and their menu bar // to stay active until the user quits explicitly with Cmd + Q if (process.platform !== 'darwin') { app.quit() } })
app.on('window-all-closed', function() { if(process.platform !== 'darwin') { app.quit() } })
// Quit when all windows are closed. app.on('window-all-closed', function() { // On OS X it is common for applications and their menu bar // to stay active until the user quits explicitly with Cmd + Q if(process.platform !== 'darwin') { app.quit() } })
// Quit when all windows are closed. app.on('window-all-closed', function () { // On OS X it is common for applications and their menu bar // to stay active until the user quits explicitly with Cmd + Q if (process.platform !== 'darwin') { app.quit() } })
app.on('window-all-closed', function () { if (process.platform !== 'darwin') { app.quit() } })
// Quit when all windows are closed. app.on('window-all-closed', () => { // On macOS it is common for applications and their menu bar // to stay active until the user quits explicitly with Cmd + Q if (process.platform !== 'darwin') { app.quit() } })
// Quit when all windows are closed. app.on('window-all-closed', function () { // On macOS it is common for applications and their menu bar // to stay active until the user quits explicitly with Cmd + Q if (process.platform !== 'darwin') { app.quit() } })
app.on('window-all-closed', () => { if (process.platform !== 'darwin') { app.quit() } })
// Quit when all windows are closed. app.on('window-all-closed', function () { // On OS X it is common for applications and their menu bar // to stay active until the user quits explicitly with Cmd + Q if (process.platform !== 'darwin') { app.quit() } })
// Quit when all windows are closed. app.on('window-all-closed', function () { // On OS X it is common for applications and their menu bar // to stay active until the user quits explicitly with Cmd + Q if (process.platform !== 'darwin') { app.quit(); } });