Sha256: 86341cef07576c7bd907e67ef77188c692524e7141215da4f69ad4ae89ef96c7

Contents?: true

Size: 840 Bytes

Versions: 29

Compression:

Stored size: 840 Bytes

Contents

const { existsSync, readFileSync } = require("fs");

// This is how long to wait for the parser to spin up. For the most part, 5
// seconds is plenty of time. But in some environments, it may be necessary to
// increase this value.
const timeoutMs = parseInt(process.env.PRETTIER_RUBY_TIMEOUT_MS || "5000", 10);

const filepath = process.argv[process.argv.length - 1];

const timeout = setTimeout(() => {
  clearInterval(interval);
  throw new Error(`Failed to get information from parse server in time. If this
    happens repeatedly, try increasing the PRETTIER_RUBY_TIMEOUT_MS environment
    variable beyond 5000.`);
}, timeoutMs);

const interval = setInterval(() => {
  if (existsSync(filepath)) {
    process.stdout.write(readFileSync(filepath).toString("utf8"));
    clearTimeout(timeout);
    clearInterval(interval);
  }
}, 100);

Version data entries

29 entries across 29 versions & 2 rubygems

Version Path
rfbeam-0.5.1 node_modules/@prettier/plugin-ruby/src/getInfo.js
rfbeam-0.5.0 node_modules/@prettier/plugin-ruby/src/getInfo.js
rfbeam-0.4.10 node_modules/@prettier/plugin-ruby/src/getInfo.js
rfbeam-0.4.9 node_modules/@prettier/plugin-ruby/src/getInfo.js
rfbeam-0.4.8 node_modules/@prettier/plugin-ruby/src/getInfo.js
rfbeam-0.4.7 node_modules/@prettier/plugin-ruby/src/getInfo.js
rfbeam-0.4.6 node_modules/@prettier/plugin-ruby/src/getInfo.js
rfbeam-0.4.5 node_modules/@prettier/plugin-ruby/src/getInfo.js
rfbeam-0.4.4 node_modules/@prettier/plugin-ruby/src/getInfo.js
rfbeam-0.4.3 node_modules/@prettier/plugin-ruby/src/getInfo.js
rfbeam-0.4.2 node_modules/@prettier/plugin-ruby/src/getInfo.js
rfbeam-0.4.1 node_modules/@prettier/plugin-ruby/src/getInfo.js
rfbeam-0.4.0 node_modules/@prettier/plugin-ruby/src/getInfo.js
rfbeam-0.3.5 node_modules/@prettier/plugin-ruby/src/getInfo.js
rfbeam-0.3.4 node_modules/@prettier/plugin-ruby/src/getInfo.js
rfbeam-0.3.3 node_modules/@prettier/plugin-ruby/src/getInfo.js
rfbeam-0.3.2 node_modules/@prettier/plugin-ruby/src/getInfo.js
rfbeam-0.3.1 node_modules/@prettier/plugin-ruby/src/getInfo.js
rfbeam-0.3.0 node_modules/@prettier/plugin-ruby/src/getInfo.js
rfbeam-0.2.2 node_modules/@prettier/plugin-ruby/src/getInfo.js