Skip to content

Commit

Permalink
perf: 🚨 Optimization error prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
viarotel committed Nov 14, 2023
1 parent 76f888b commit b759502
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
8 changes: 5 additions & 3 deletions electron/exposes/adbkit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ const spawnShell = async (command, { stdout, stderr } = {}) => {
}
})

let lastStderr = ''
const stderrList = []
spawnProcess.stderr.on('data', (data) => {
const stringData = data.toString()

lastStderr = stringData
stderrList.push(stringData)

console.error('spawnProcess.stderr.data:', stringData)

Expand All @@ -87,7 +87,9 @@ const spawnShell = async (command, { stdout, stderr } = {}) => {
resolve()
}
else {
reject(new Error(lastStderr || `Command failed with code ${code}`))
reject(
new Error(stderrList.join(',') || `Command failed with code ${code}`),
)
}
})

Expand Down
8 changes: 5 additions & 3 deletions electron/exposes/gnirehtet/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ const shell = async (command, { debug = false, stdout, stderr } = {}) => {
}
})

let lastStderr = ''
const stderrList = []
gnirehtetProcess.stderr.on('data', (data) => {
const stringData = data.toString()

lastStderr = stringData
stderrList.push(stringData)

if (debug) {
console.error(`${command}.gnirehtet.process.stderr.data:`, stringData)
Expand All @@ -69,7 +69,9 @@ const shell = async (command, { debug = false, stdout, stderr } = {}) => {
resolve()
}
else {
reject(new Error(`Command failed with code ${code}`))
reject(
new Error(stderrList.join(',') || `Command failed with code ${code}`),
)
}
})

Expand Down
8 changes: 5 additions & 3 deletions electron/exposes/scrcpy/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ const shell = async (command, { stdout, stderr } = {}) => {
}
})

let lastStderr = ''
const stderrList = []
scrcpyProcess.stderr.on('data', (data) => {
const stringData = data.toString()

lastStderr = stringData
stderrList.push(stringData)

console.error('scrcpyProcess.stderr.data:', stringData)

Expand All @@ -52,7 +52,9 @@ const shell = async (command, { stdout, stderr } = {}) => {
resolve()
}
else {
reject(new Error(lastStderr || `Command failed with code ${code}`))
reject(
new Error(stderrList.join(',') || `Command failed with code ${code}`),
)
}
})

Expand Down

0 comments on commit b759502

Please sign in to comment.