perf: 🚨 Optimization error prompt

This commit is contained in:
viarotel 2023-11-14 11:06:36 +08:00
parent 76f888baf6
commit b75950298f
3 changed files with 15 additions and 9 deletions

View File

@ -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)
@ -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}`),
)
}
})

View File

@ -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)
@ -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}`),
)
}
})

View File

@ -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)
@ -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}`),
)
}
})