Migrate fbEmployee
Summary: _typescript_ Reviewed By: jknoxville Differential Revision: D16827958 fbshipit-source-id: f2ab616b2682ede7da6c1e401fcc6d0644a1b960
This commit is contained in:
committed by
Facebook Github Bot
parent
2fac83420b
commit
03d4a7d750
@@ -24,7 +24,7 @@ import {stateSanitizer} from './utils/reduxDevToolsConfig';
|
|||||||
import {initLauncherHooks} from './utils/launcher';
|
import {initLauncherHooks} from './utils/launcher';
|
||||||
import initCrashReporter from './utils/electronCrashReporter';
|
import initCrashReporter from './utils/electronCrashReporter';
|
||||||
import fbConfig from './fb-stubs/config';
|
import fbConfig from './fb-stubs/config';
|
||||||
import {isFBEmployee} from './utils/fbEmployee.js';
|
import {isFBEmployee} from './utils/fbEmployee';
|
||||||
import WarningEmployee from './chrome/WarningEmployee';
|
import WarningEmployee from './chrome/WarningEmployee';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
|
|||||||
@@ -11,14 +11,14 @@ const exec = util.promisify(require('child_process').exec);
|
|||||||
const cmd = 'klist --json';
|
const cmd = 'klist --json';
|
||||||
const endWith = '@THEFACEBOOK.COM';
|
const endWith = '@THEFACEBOOK.COM';
|
||||||
|
|
||||||
export function isFBEmployee(): Promise<boolean> {
|
export async function isFBEmployee(): Promise<boolean> {
|
||||||
return exec(cmd).then(
|
return exec(cmd).then(
|
||||||
(stdobj: {stderr: string, stdout: string}) => {
|
(stdobj: {stderr: string; stdout: string}) => {
|
||||||
const principal = String(JSON.parse(stdobj.stdout).principal);
|
const principal = String(JSON.parse(stdobj.stdout).principal);
|
||||||
|
|
||||||
return principal.endsWith(endWith);
|
return principal.endsWith(endWith);
|
||||||
},
|
},
|
||||||
err => {
|
(_err: Error) => {
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
Reference in New Issue
Block a user