mirror of https://github.com/actions/toolkit
parent
439eaced07
commit
c5035362ab
|
@ -84,7 +84,7 @@ export class ToolRunner extends events.EventEmitter {
|
||||||
data: Buffer,
|
data: Buffer,
|
||||||
strBuffer: string,
|
strBuffer: string,
|
||||||
onLine: (line: string) => void
|
onLine: (line: string) => void
|
||||||
): void {
|
): string {
|
||||||
try {
|
try {
|
||||||
let s = strBuffer + data.toString()
|
let s = strBuffer + data.toString()
|
||||||
let n = s.indexOf(os.EOL)
|
let n = s.indexOf(os.EOL)
|
||||||
|
@ -98,10 +98,12 @@ export class ToolRunner extends events.EventEmitter {
|
||||||
n = s.indexOf(os.EOL)
|
n = s.indexOf(os.EOL)
|
||||||
}
|
}
|
||||||
|
|
||||||
strBuffer = s
|
return s
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// streaming lines to console is best effort. Don't fail a build.
|
// streaming lines to console is best effort. Don't fail a build.
|
||||||
this._debug(`error processing line. Failed with error ${err}`)
|
this._debug(`error processing line. Failed with error ${err}`)
|
||||||
|
|
||||||
|
return ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -444,7 +446,7 @@ export class ToolRunner extends events.EventEmitter {
|
||||||
this._getSpawnOptions(this.options, fileName)
|
this._getSpawnOptions(this.options, fileName)
|
||||||
)
|
)
|
||||||
|
|
||||||
const stdbuffer = ''
|
let stdbuffer = ''
|
||||||
if (cp.stdout) {
|
if (cp.stdout) {
|
||||||
cp.stdout.on('data', (data: Buffer) => {
|
cp.stdout.on('data', (data: Buffer) => {
|
||||||
if (this.options.listeners && this.options.listeners.stdout) {
|
if (this.options.listeners && this.options.listeners.stdout) {
|
||||||
|
@ -455,15 +457,19 @@ export class ToolRunner extends events.EventEmitter {
|
||||||
optionsNonNull.outStream.write(data)
|
optionsNonNull.outStream.write(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
this._processLineBuffer(data, stdbuffer, (line: string) => {
|
stdbuffer = this._processLineBuffer(
|
||||||
|
data,
|
||||||
|
stdbuffer,
|
||||||
|
(line: string) => {
|
||||||
if (this.options.listeners && this.options.listeners.stdline) {
|
if (this.options.listeners && this.options.listeners.stdline) {
|
||||||
this.options.listeners.stdline(line)
|
this.options.listeners.stdline(line)
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const errbuffer = ''
|
let errbuffer = ''
|
||||||
if (cp.stderr) {
|
if (cp.stderr) {
|
||||||
cp.stderr.on('data', (data: Buffer) => {
|
cp.stderr.on('data', (data: Buffer) => {
|
||||||
state.processStderr = true
|
state.processStderr = true
|
||||||
|
@ -482,11 +488,15 @@ export class ToolRunner extends events.EventEmitter {
|
||||||
s.write(data)
|
s.write(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
this._processLineBuffer(data, errbuffer, (line: string) => {
|
errbuffer = this._processLineBuffer(
|
||||||
|
data,
|
||||||
|
errbuffer,
|
||||||
|
(line: string) => {
|
||||||
if (this.options.listeners && this.options.listeners.errline) {
|
if (this.options.listeners && this.options.listeners.errline) {
|
||||||
this.options.listeners.errline(line)
|
this.options.listeners.errline(line)
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue