Haroenv / dev-ui

[WIP] Browser UI for npm and yarn (scripts, dependencies …)
MIT License
16 stars 5 forks source link

Stream output from terminal commands #12

Open Haroenv opened 6 years ago

Haroenv commented 6 years ago

I did the very basics of streaming the output of execa, but not correctly I think

  1. click on a command name (there should be a "run" button next to it IMO)
  2. command starts on the server
  3. streams to frontend
  4. output continually gets shown in terminal output
    • can be done later: colouring

There should be an in-memory storage of the ran scripts, which is removed when the command is done, so .kill() can be called to the command from the frontend

Haroenv commented 6 years ago

so it works pretty well via #14, but the colours are still flaky for some reason. Maybe it manages to miss a single packet?

azz commented 6 years ago

Also need to handle the move to start of line ANSI code (or just \r?)

image

azz commented 6 years ago

Jest looks good though - unicode problem is fixed!

image

Haroenv commented 6 years ago

We should probably just do a newline if the command is trying to rewrite the line

azz commented 6 years ago

Something is awry with the ansi-html stream...

<span 0="<" 1="s" 2="p" 3="a" 4="n" 5=" " 6="0" 7="=" 8="" 9="<" 10="" 11=" " 12="1" 13="=" 14="" 15="s" 16="" 17=" " 18="2" 19="=" 20="" 21="p" 22="" 23=" " 24="3" 25="=" 26="" 27="a" 28="" 29=" " 30="4" 31="=" 32="" 33="n" 34="" 35=" " 36="5" 37="=" 38="" 39=" " 40="" 41=" " 42="6" 43="=" 44="" 45="s" 46="" 47=" " 48="7" 49="=" 50="" 51="t" 52="" 53=" " 54="8" 55="=" 56="" 57="y" 58="" 59=" " 60="9" 61="=" 62="" 63="l" 64="" 65=" " 66="1" 67="0" 68="=" 69="" 70="e" 71="" 72=" " 73="1" 74="1" 75="=" 76="" 77="=" 78="" 79=" " 80="1" 81="2" 82="=" 83="" 84="" 85=" " 86="1" 87="3" 88="=" 89="" 90="c" 91="" 92=" " 93="1" 94="4" 95="=" 96="" 97="o" 98="" 99=" " 100="1" 101="5" 102="=" 103="" 104="l" 105="" 106=" " 107="1" 108="6" 109="=" 110="" 111="o" 112="" 113=" " 114="1" 115="7" 116="=" 117="" 118="r" 119="" 120=" " 121="1" 122="8" 123="=" 124="" 125=":" 126="" 127=" " 128="1" 129="9" 130="=" 131="" 132="g" 133="" 134=" " 135="2" 136="0" 137="=" 138="" 139="r" 140="" 141=" " 142="2" 143="1" 144="=" 145="" 146="e" 147="" 148=" " 149="2" 150="2" 151="=" 152="" 153="e" 154="" 155=" " 156="2" 157="3" 158="=" 159="" 160="n" 161="" 162=" " 163="2" 164="4" 165="=" 166="" 167="" 168=" " 169="2" 170="5" 171="=" 172="" 173=">" 174="" 175=">">
ranfdev commented 6 years ago

If i try to run a script multiple times, the stream will get slower, until the app crashes. How to reproduce: click on the rainbow script multiple times

Haroenv commented 6 years ago

I think the stream is actually never stopped 🤔 even though kill is called afaict

ranfdev commented 6 years ago

I removed the theme and now i don't get any problem, check the PR #38