A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/seleniumhq/selenium/commit/a5b0ad9dc1bb3f4698ec4c5eb827fc05ed527843 below:

[js] Replace `execSync` with `spawnSync` in `seleniumManager.js` (#11… · SeleniumHQ/selenium@a5b0ad9 · GitHub

File tree Expand file treeCollapse file tree 1 file changed

+22

-15

lines changed

Filter options

Expand file treeCollapse file tree 1 file changed

+22

-15

lines changed Original file line number Diff line number Diff line change

@@ -24,7 +24,7 @@

24 24

const { platform } = require('process')

25 25

const path = require('path')

26 26

const fs = require('fs')

27 -

const execSync = require('child_process').execSync

27 +

const spawnSync = require('child_process').spawnSync

28 28 29 29

/**

30 30

* currently supported browsers for selenium-manager

@@ -53,7 +53,6 @@ function getBinary() {

53 53

} else {

54 54

seleniumManagerBasePath = path.join(__dirname, '..', '/bin')

55 55

}

56 -

console.log(seleniumManagerBasePath)

57 56 58 57

const filePath = path.join(seleniumManagerBasePath, directory, file)

59 58

@@ -77,7 +76,7 @@ function driverLocation(options) {

77 76

)

78 77

}

79 78 80 -

let args = [getBinary(), '--browser', options.getBrowserName(), '--output', 'json']

79 +

let args = ['--browser', options.getBrowserName(), '--output', 'json']

81 80 82 81

if (options.getBrowserVersion() && options.getBrowserVersion() !== "") {

83 82

args.push("--browser-version", options.getBrowserVersion())

@@ -89,22 +88,30 @@ function driverLocation(options) {

89 88

args.push("--browser-path", '"' + vendorOptions.binary + '"')

90 89

}

91 90 91 +

const smBinary = getBinary()

92 +

const spawnResult = spawnSync(smBinary, args)

92 93

let output

93 -

try {

94 -

output = JSON.parse(execSync(args.join(' ')).toString())

95 -

} catch (e) {

96 -

let error

97 -

try {

98 -

error = JSON.parse(e.stdout.toString()).result.message

99 -

} catch (e) {

100 -

if (e instanceof SyntaxError) {

101 -

error = e.stdout.toString()

102 -

} else {

103 -

error = e.toString()

94 +

if (spawnResult.status) {

95 +

let errorMessage

96 +

if (spawnResult.stderr.toString()) {

97 +

errorMessage = spawnResult.stderr.toString()

98 +

}

99 +

if (spawnResult.stdout.toString()) {

100 +

try {

101 +

output = JSON.parse(spawnResult.stdout.toString())

102 +

errorMessage = output.result.message

103 +

} catch (e) {

104 +

errorMessage = e.toString()

104 105

}

105 106

}

106 -

throw new Error(`Error executing command with ${args}: ${error}`)

107 +

throw new Error(`Error executing command for ${smBinary} with ${args}: ${errorMessage}`)

107 108

}

109 +

try {

110 +

output = JSON.parse(spawnResult.stdout.toString())

111 +

} catch (e) {

112 +

throw new Error(`Error executing command for ${smBinary} with ${args}: ${e.toString()}`)

113 +

}

114 + 108 115 109 116

for (const key in output.logs) {

110 117

if (output.logs[key].level === 'WARN') {

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4