adobe/aio-cli-plugin-runtime

Activation logs poll with strip modifies log line order

rabbah opened this issue · 3 comments

Describe the bug

For this action:

function main() {
    console.log('stdout A')
    console.error('stderr C')
    console.log('stdout B')
    console.error('stderr D')
}

Invoke it and look at the activation logs, with and without --strip.

> run activation logs b221072515cd478ca1072515cd978cdf
2021-06-22T17:52:45.917875645Z stdout: stdout A
2021-06-22T17:52:45.918022439Z stderr: stderr C
2021-06-22T17:52:45.918104067Z stderr: stderr D
2021-06-22T17:52:45.918169525Z stdout: stdout B
> run activation logs b221072515cd478ca1072515cd978cdf --strip
stdout A
stderr C
stderr D
stdout B
> activation logs --poll --action hello 
=== b221072515cd478ca1072515cd978cdf (success) 06/22 13:52:45 hello:0.0.4
2021-06-22T17:52:45.917875645Z stdout: stdout A
2021-06-22T17:52:45.918022439Z stderr: stderr C
2021-06-22T17:52:45.918104067Z stderr: stderr D
2021-06-22T17:52:45.918169525Z stdout: stdout B

this one modifies the line order, here emitting stderr first then stdout.

> activation logs --poll --action hello --strip 
=== b221072515cd478ca1072515cd978cdf (success) 06/22 13:52:45 hello:0.0.4
stderr C
stderr D
stdout A
stdout B

To Reproduce
Steps to reproduce the behavior:

  1. Create action as shown.
  2. Invoke it.
  3. Run show commands.
  4. See error.

Expected behavior
The log line order should be the same with and without strip.

This looks like it also affects --last:

> run activation logs --last
=== 3009831372ef4fca89831372ef9fcae8 (success) 06/22 13:52:51 hello:0.0.4
2021-06-22T17:52:51.296559977Z stdout: stdout A
2021-06-22T17:52:51.296615878Z stderr: stderr C
2021-06-22T17:52:51.296667727Z stdout: stdout B
2021-06-22T17:52:51.296794251Z stderr: stderr D
> run activation logs --last --strip
=== 3009831372ef4fca89831372ef9fcae8 (success) 06/22 13:52:51 hello:0.0.4
stderr C
stderr D
stdout A
stdout B

vs

> run activation logs 3009831372ef4fca89831372ef9fcae8
2021-06-22T17:52:51.296559977Z stdout: stdout A
2021-06-22T17:52:51.296615878Z stderr: stderr C
2021-06-22T17:52:51.296667727Z stdout: stdout B
2021-06-22T17:52:51.296794251Z stderr: stderr D
> run activation logs 3009831372ef4fca89831372ef9fcae8 --strip
stdout A
stderr C
stdout B
stderr D

Hi @rabbah , thanks for raising the issue. We'll have a look at it.