Demo for query storing
Change-Id: I947bcac841992c3f6cfd01ab337c265b0d01cb70
diff --git a/node_modules/bin-check/index.js b/node_modules/bin-check/index.js
new file mode 100644
index 0000000..49100bd
--- /dev/null
+++ b/node_modules/bin-check/index.js
@@ -0,0 +1,31 @@
+'use strict';
+const execa = require('execa');
+const executable = require('executable');
+
+module.exports = (bin, args) => {
+ if (!Array.isArray(args)) {
+ args = ['--help'];
+ }
+
+ return executable(bin)
+ .then(works => {
+ if (!works) {
+ throw new Error(`Couldn't execute the \`${bin}\` binary. Make sure it has the right permissions.`);
+ }
+
+ return execa(bin, args);
+ })
+ .then(res => res.code === 0);
+};
+
+module.exports.sync = (bin, args) => {
+ if (!Array.isArray(args)) {
+ args = ['--help'];
+ }
+
+ if (!executable.sync(bin)) {
+ throw new Error(`Couldn't execute the \`${bin}\` binary. Make sure it has the right permissions.`);
+ }
+
+ return execa.sync(bin, args).status === 0;
+};