MVM

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

MVM

Tobias Pape
 
Hi all, especially Eliot

I accidentally committed an experiment but I think it's worthwile.

Look at https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/Cog/build.linux32x86/squeak.cog.spur/build.debug/mvm#L36

I replaced
        make install-squeak install-plugins prefix=`(cd ../../../;pwd)`/products/$INSTALLDIR 2>&1 | tee LOG
with
        exec \
            script -f -q -e -c \
            "make install-squeak install-plugins prefix=`(cd ../../../;pwd)`/products/$INSTALLDIR" \
            >(sed "s/\x1B\[\([0-9]\{1,2\}\(;[0-9]\{1,2\}\)\?\)\?[mGK]//g" > LOG)

Which amounts to nearly the same result (compile outputs to terminal and to LOGfile)
but the script do not see the redirection. The idea is to preserve Color output for terminal and travis (because it is actually really useful) but strip all Ansi stuff for the LOG file (hence the sed script).

I had this for quite some weeks now and it works fine (no extra deps, its all (script, sed) there on unixes)

What do you all think?

Best regards
        -Tobias



Reply | Threaded
Open this post in threaded view
|

Re: MVM

fniephaus
 
Hi Tobias,

On Tue, Mar 20, 2018 at 2:16 PM Tobias Pape <[hidden email]> wrote:

Hi all, especially Eliot

I accidentally committed an experiment but I think it's worthwile.

Look at https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/Cog/build.linux32x86/squeak.cog.spur/build.debug/mvm#L36

I replaced
        make install-squeak install-plugins prefix=`(cd ../../../;pwd)`/products/$INSTALLDIR 2>&1 | tee LOG
with
        exec \
            script -f -q -e -c \
            "make install-squeak install-plugins prefix=`(cd ../../../;pwd)`/products/$INSTALLDIR" \
            >(sed "s/\x1B\[\([0-9]\{1,2\}\(;[0-9]\{1,2\}\)\?\)\?[mGK]//g" > LOG)

Which amounts to nearly the same result (compile outputs to terminal and to LOGfile)
but the script do not see the redirection. The idea is to preserve Color output for terminal and travis (because it is actually really useful) but strip all Ansi stuff for the LOG file (hence the sed script).

I had this for quite some weeks now and it works fine (no extra deps, its all (script, sed) there on unixes)

What do you all think?

The purpose (preserving colors) is great, the readability of the script not so much IMHO.
Could this magic script be extracted into some more meaningful helper function like `runAndLogWhilePreservingColors`? A brief explanation of how the magic works could also be helpful. I literally stopped trying to parse the script in my head after seeing all the flags for `script`.

Best,
Fabio
 

Best regards
        -Tobias



Reply | Threaded
Open this post in threaded view
|

Re: MVM

Eliot Miranda-2
 


On Tue, Mar 20, 2018 at 8:28 AM, Fabio Niephaus <[hidden email]> wrote:
 
Hi Tobias,

On Tue, Mar 20, 2018 at 2:16 PM Tobias Pape <[hidden email]> wrote:

Hi all, especially Eliot

I accidentally committed an experiment but I think it's worthwile.

Look at https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/Cog/build.linux32x86/squeak.cog.spur/build.debug/mvm#L36

I replaced
        make install-squeak install-plugins prefix=`(cd ../../../;pwd)`/products/$INSTALLDIR 2>&1 | tee LOG
with
        exec \
            script -f -q -e -c \
            "make install-squeak install-plugins prefix=`(cd ../../../;pwd)`/products/$INSTALLDIR" \
            >(sed "s/\x1B\[\([0-9]\{1,2\}\(;[0-9]\{1,2\}\)\?\)\?[mGK]//g" > LOG)

Which amounts to nearly the same result (compile outputs to terminal and to LOGfile)
but the script do not see the redirection. The idea is to preserve Color output for terminal and travis (because it is actually really useful) but strip all Ansi stuff for the LOG file (hence the sed script).

I had this for quite some weeks now and it works fine (no extra deps, its all (script, sed) there on unixes)

What do you all think?

The purpose (preserving colors) is great, the readability of the script not so much IMHO.
Could this magic script be extracted into some more meaningful helper function like `runAndLogWhilePreservingColors`? A brief explanation of how the magic works could also be helpful. I literally stopped trying to parse the script in my head after seeing all the flags for `script`.

+1

BTW, neither .travis_helpers.sh nor .travis_install.sh begin with #!/bin/bash

 

Best,
Fabio
 

Best regards
        -Tobias

_,,,^..^,,,_
best, Eliot
Reply | Threaded
Open this post in threaded view
|

Re: MVM

timrowledge
In reply to this post by fniephaus
 


>         exec \
>             script -f -q -e -c \
>             "make install-squeak install-plugins prefix=`(cd ../../../;pwd)`/products/$INSTALLDIR" \
>             >(sed "s/\x1B\[\([0-9]\{1,2\}\(;[0-9]\{1,2\}\)\?\)\?[mGK]//g" > LOG)

This is why this unix stuff will never catch on, mark my words!

tim
--
tim Rowledge; [hidden email]; http://www.rowledge.org/tim
Strange OpCodes: SDJ: Send all Data to Japan