Coder Social home page Coder Social logo

Comments (7)

jkutner avatar jkutner commented on August 26, 2024

@dzuelke exec 1>&2 works well for Bash, but we expect buildpacks to be written in other languages too. I'm so sure that redirection is as easy or reliable. Any solution would need to be 100% reliable because any cruft in stderr would result in invalid TOML, and fail a build.

from spec.

nebhale avatar nebhale commented on August 26, 2024

In addition, we've seen with the previous generation of buildpacks, that many authors and others who interacted with buildpacks considered the use of stdout for conveying information problematic in practice. We've seen requests to move further away from using stdout, rather than closer, so we now have input in both directions.

from spec.

dzuelke avatar dzuelke commented on August 26, 2024

@jkutner but surely if you write a buildpack in another language, you wouldn't just puts or whatever text, but run it through some kind of minimalist I/O wrapper, in order for things to be properly testable etc, right?

@nebhale I'm not sure I follow. I'm saying that stdout shouldn't be used for informational output, but stderr, which is standard Unix practice, and which is what almost all programs do. It's the reason you can do curl foo | bar: data (in the case of bin/build that'd be the TOML output) goes to stdout, and status/info/error/debug messaging (such as curl's progress bar) to stderr.

from spec.

nebhale avatar nebhale commented on August 26, 2024

Sorry, I was sloppy with my terminology. What I mean to say is:

In addition, we've seen with the previous generation of buildpacks, that many authors and others who interacted with buildpacks considered the use of stdin/stdout for conveying programmatic input/output problematic in practice. We've seen requests to move further away from using stdin/stdout for programmatic input/output, rather than closer, so we now have design requests in both directions.

from spec.

sclevine avatar sclevine commented on August 26, 2024

Appreciate the feedback @dzuelke! Definitely want to make sure these interfaces are reasonable.

I'm saying that stdout shouldn't be used for informational output, but stderr, which is standard Unix practice, and which is what almost all programs do. It's the reason you can do curl foo | bar: data (in the case of bin/build that'd be the TOML output) goes to stdout, and status/info/error/debug messaging (such as curl's progress bar) to stderr.

I definitely agree with this practice for command line utilities on UNIX systems. That said, I'm not convinced that we should do this for /bin/build.

Here are some disadvantages I can think of:

  • The primary responsibility of /bin/build is to execute other CLI utilities. Preserving the separation of stdout and stderr from these utilities seems desirable on cloud platforms, where logs sent to stderr are sometimes formatted differently (e.g., bold or red) compared to logs sent to stdout. In practice, many language tools (e.g., npm, gem) send logs to both stdout and stderr so they can split informational logs from diagnostic logs. Shouldn't we preserve that split?
  • The entire output of /bin/build cannot be sent to stdout, just the buildpack metadata. Sending just the contents of launch.toml to stdout would split the output between stdout and disk (launch + cache layers). This seems less elegant to me than having just the launch and cache directories be the output.
  • We would prevent buildpack authors from using libraries that are hardcoded to output to stdout or output to stdout by accident. Such libraries could even silently corrupt the metadata. (Note: This can be completely avoided for languages that let you make the dup2 syscall on Linux directly, like C or Go.)
  • We would make writing a buildpack in a less common language difficult for users who are not familiar with output redirection.

Do those reasons make sense to you? What benefits do you see for sending the metadata to stdout?

from spec.

dzuelke avatar dzuelke commented on August 26, 2024

I guess :) Thanks folks! It was just a minor nitpick really.

from spec.

sclevine avatar sclevine commented on August 26, 2024

@dzuelke #24 makes the build/detect interfaces match, so at least they are consistent 😄

from spec.

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.