|
1 | 1 | const JSONRPC = require(".."); |
2 | 2 |
|
| 3 | +const exec = require("child_process").exec; |
| 4 | + |
3 | 5 | const http = require("http"); |
4 | 6 | const url = require("url"); |
5 | 7 | const path = require("path"); |
6 | 8 | const fs = require("fs"); |
| 9 | +const os = require("os"); |
7 | 10 |
|
8 | 11 | const sleep = require("sleep-promise"); |
9 | 12 |
|
@@ -1011,16 +1014,40 @@ class AllTests |
1011 | 1014 | } |
1012 | 1015 | ); |
1013 | 1016 |
|
| 1017 | + let phantomPage; |
1014 | 1018 | try |
1015 | 1019 | { |
1016 | | - const phantomPage = await phantom.createPage(); |
| 1020 | + phantomPage = await phantom.createPage(); |
1017 | 1021 | } |
1018 | 1022 | catch(error) |
1019 | 1023 | { |
1020 | | - if(error.message.includes("Error reading from stdin")) |
| 1024 | + if( |
| 1025 | + error.message.includes("Error reading from stdin") |
| 1026 | + && os.platform() === "linux" |
| 1027 | + ) |
1021 | 1028 | { |
1022 | 1029 | // https://github.com/amir20/phantomjs-node/issues/649 |
1023 | | - return; |
| 1030 | + console.error("phantomjs may have reported an error in the phantom library."); |
| 1031 | + console.error("If missing phantomjs dependencies: yum install libXext libXrender fontconfig libfontconfig.so.1"); |
| 1032 | + |
| 1033 | + const processCommand = exec("../node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs --help"); |
| 1034 | + processCommand.stdout.pipe(process.stdout); |
| 1035 | + processCommand.stderr.pipe(process.stderr); |
| 1036 | + await new Promise(async (fnResolve, fnReject) => { |
| 1037 | + processCommand.on("error", fnReject); |
| 1038 | + processCommand.on("exit", (nCode) => { |
| 1039 | + if(nCode === 0) |
| 1040 | + { |
| 1041 | + fnResolve(); |
| 1042 | + } |
| 1043 | + else |
| 1044 | + { |
| 1045 | + fnReject(new Error("Failed with error code " + nCode)); |
| 1046 | + } |
| 1047 | + }); |
| 1048 | + }); |
| 1049 | + |
| 1050 | + process.exit(1); |
1024 | 1051 | } |
1025 | 1052 |
|
1026 | 1053 | throw error; |
|
0 commit comments