Giter Club home page Giter Club logo

Comments (4)

mfragkoulis avatar mfragkoulis commented on May 28, 2024

The hang was due to the treatment of printf as a builtin.

That said the graph dgsh -c 'echo hi | {{ cat & printf there & }} | cat' is awkward because echo cannot provide multiple outputs.

dgsh -c '{{ echo hi & printf there & }} | cat' would be more appropriate.

However, the output is only hi if printf does not use a newline.
The following works normally:
dgsh -c '{{ echo hi & printf "there\n" & }} | cat'

from dgsh.

dspinellis avatar dspinellis commented on May 28, 2024

Calling printf now works correctly even without a newline. Perhaps you didn't notice thethere before the prompt? (It would have been a serious problem if we treated newlines specially at this level.)

$ dgsh -c '{{ echo hi & printf there & }} | cat'
hi
there$

from dgsh.

dspinellis avatar dspinellis commented on May 28, 2024

A few more things remain to close this.

  • Statements (e.g. dgsh -c 'echo hi | {{ cat & cat & }} | cat') should error, not hang.
  • We should also handle correctly other builtins that can cause trouble.
  • Ideally, we should just auto-wrap builtins when needed, rather than remove them. This will make it easier to integrate dgsh functionality into the bash distribution.

from dgsh.

mfragkoulis avatar mfragkoulis commented on May 28, 2024

The graph dgsh -c 'echo hi | {{ cat & printf there & }} | cat' is totally legitimate and the handling is the expected; the command runs and terminates normally.
Don't mind me, it was late last night :-)
The graph dgsh -c 'echo hi | {{ cat & cat & }} | cat' is not allowed at the moment because of the presence of two flexible commands in a multiple block (we will revisit this in issue #4 -- multipipe blocks). The graph now exits with an error, it does not hang.
Rephrased 1/3 and checked it.

from dgsh.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.