| 5 | const concurrently = require("concurrently"); |
| 6 | |
| 7 | function spawnSync(cmd, args, options) { |
| 8 | const result = rawSpawnSync(cmd, args, { |
| 9 | stdio: ["pipe", "inherit", "inherit"], |
| 10 | env: { |
| 11 | ...process.env, |
| 12 | YARN_SILENT: "1", |
| 13 | npm_config_loglevel: "silent", |
| 14 | }, |
| 15 | shell: true, |
| 16 | ...options, |
| 17 | }); |
| 18 | |
| 19 | const { error, status, signal, stderr, stdout } = result; |
| 20 | |
| 21 | if (error) { |
| 22 | throw error; |
| 23 | } |
| 24 | |
| 25 | if (status || signal) { |
| 26 | if (stdout) { |
| 27 | console.log(stdout.toString("utf8")); |
| 28 | } |
| 29 | if (stderr) { |
| 30 | console.error(stderr.toString("utf8")); |
| 31 | } |
| 32 | if (status) { |
| 33 | throw new Error( |
| 34 | `Process exited with status '${status}' (running '${cmd} ${ |
| 35 | args ? args.join(" ") : "" |
| 36 | }')` |
| 37 | ); |
| 38 | } else { |
| 39 | throw new Error( |
| 40 | `Process exited due to signal '${signal}' (running '${cmd} ${ |
| 41 | args ? args.join(" ") : null |
| 42 | }')` |
| 43 | ); |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | return result; |
| 48 | } |
| 49 | |
| 50 | // Dear graphile-migrate, please treat the test DB as if it were the shadow DB |
| 51 | process.env.SHADOW_DATABASE_URL = process.env.TEST_DATABASE_URL; |