Upgrade eslint and prettier
Summary: Not a fan of the long lines, but if that's where prettier is going, let's roll with it. Reviewed By: jknoxville Differential Revision: D17905599 fbshipit-source-id: c4232d46d2ec0b7c743f6afd8349106c85f013b9
This commit is contained in:
committed by
Facebook Github Bot
parent
54ebb44dda
commit
874e590b96
@@ -50,44 +50,43 @@ const basicArgs = [
|
||||
params.insecurePort,
|
||||
];
|
||||
|
||||
const runHeadless = memoize(
|
||||
(args: Array<string>): Promise<{output: Object, stderr: string}> => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const stdoutChunks = [];
|
||||
const stderrChunks = [];
|
||||
console.info(`Running ${params.bin} ${args.join(' ')}`);
|
||||
const process = spawn(params.bin, args, {});
|
||||
process.stdout.setEncoding('utf8');
|
||||
process.stdout.on('data', chunk => {
|
||||
stdoutChunks.push(chunk);
|
||||
});
|
||||
process.stderr.on('data', chunk => {
|
||||
stderrChunks.push(chunk);
|
||||
});
|
||||
process.stdout.on('end', chunk => {
|
||||
const stdout = stdoutChunks.join('');
|
||||
const stderr = stderrChunks.join('');
|
||||
try {
|
||||
console.log(stderr);
|
||||
resolve({output: JSON.parse(stdout), stderr: stderr});
|
||||
} catch (e) {
|
||||
console.warn(stderr);
|
||||
reject(
|
||||
new Error(
|
||||
`Failed to parse headless output as JSON (${
|
||||
e.message
|
||||
}): ${stdout}`,
|
||||
),
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
process.kill('SIGINT');
|
||||
}, 20000);
|
||||
const runHeadless = memoize((args: Array<string>): Promise<{
|
||||
output: Object,
|
||||
stderr: string,
|
||||
}> => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const stdoutChunks = [];
|
||||
const stderrChunks = [];
|
||||
console.info(`Running ${params.bin} ${args.join(' ')}`);
|
||||
const process = spawn(params.bin, args, {});
|
||||
process.stdout.setEncoding('utf8');
|
||||
process.stdout.on('data', chunk => {
|
||||
stdoutChunks.push(chunk);
|
||||
});
|
||||
},
|
||||
);
|
||||
process.stderr.on('data', chunk => {
|
||||
stderrChunks.push(chunk);
|
||||
});
|
||||
process.stdout.on('end', chunk => {
|
||||
const stdout = stdoutChunks.join('');
|
||||
const stderr = stderrChunks.join('');
|
||||
try {
|
||||
console.log(stderr);
|
||||
resolve({output: JSON.parse(stdout), stderr: stderr});
|
||||
} catch (e) {
|
||||
console.warn(stderr);
|
||||
reject(
|
||||
new Error(
|
||||
`Failed to parse headless output as JSON (${e.message}): ${stdout}`,
|
||||
),
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
process.kill('SIGINT');
|
||||
}, 20000);
|
||||
});
|
||||
});
|
||||
|
||||
function getPluginState(app: string, plugin: string): Promise<string> {
|
||||
return runHeadless(basicArgs).then(result => {
|
||||
|
||||
Reference in New Issue
Block a user