Skip to content

Commit

Permalink
Update to beta6 of the protocol
Browse files Browse the repository at this point in the history
Fixes #4
  • Loading branch information
bep committed Feb 6, 2021
1 parent 4fa5ebe commit 28e22de
Show file tree
Hide file tree
Showing 9 changed files with 846 additions and 569 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ jobs:
- name: Install dart-sass-embedded Linux
if: matrix.os == 'ubuntu-latest'
run: |
curl -LJO https://github.com/sass/dart-sass-embedded/releases/download/1.0.0-beta.5/sass_embedded-1.0.0-beta.5-linux-x64.tar.gz;
tar -xvf sass_embedded-1.0.0-beta.5-linux-x64.tar.gz;
curl -LJO https://github.com/sass/dart-sass-embedded/releases/download/1.0.0-beta.6/sass_embedded-1.0.0-beta.6-linux-x64.tar.gz;
tar -xvf sass_embedded-1.0.0-beta.6-linux-x64.tar.gz;
echo "DART_SASS_EMBEDDED_BINARY=$GITHUB_WORKSPACE/sass_embedded/dart-sass-embedded" >> $GITHUB_ENV
- name: Install dart-sass-embedded MacOS
if: matrix.os == 'macos-latest'
run: |
curl -LJO https://github.com/sass/dart-sass-embedded/releases/download/1.0.0-beta.5/sass_embedded-1.0.0-beta.5-macos-x64.tar.gz;
tar -xvf sass_embedded-1.0.0-beta.5-macos-x64.tar.gz;
curl -LJO https://github.com/sass/dart-sass-embedded/releases/download/1.0.0-beta.6/sass_embedded-1.0.0-beta.6-macos-x64.tar.gz;
tar -xvf sass_embedded-1.0.0-beta.6-macos-x64.tar.gz;
echo "DART_SASS_EMBEDDED_BINARY=$GITHUB_WORKSPACE/sass_embedded/dart-sass-embedded" >> $GITHUB_ENV
- name: Install dart-sass-embedded Windows
if: matrix.os == 'windows-latest'
run: |
curl -LJO https://github.com/sass/dart-sass-embedded/releases/download/1.0.0-beta.5/sass_embedded-1.0.0-beta.5-windows-x64.zip;
unzip sass_embedded-1.0.0-beta.5-windows-x64.zip;
curl -LJO https://github.com/sass/dart-sass-embedded/releases/download/1.0.0-beta.6/sass_embedded-1.0.0-beta.6-windows-x64.zip;
unzip sass_embedded-1.0.0-beta.6-windows-x64.zip;
echo "DART_SASS_EMBEDDED_BINARY=$env:GITHUB_WORKSPACE/sass_embedded/dart-sass-embedded.bat" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
- name: Test
run: go test -race . -coverprofile=coverage.txt -covermode=atomic
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@
# Output of the go coverage tool, specifically when used with LiteIDE
*.out

lib/

# Dependency directories (remove the comment below to include it)
# vendor/
16 changes: 12 additions & 4 deletions conn.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package godartsass

import (
"bufio"
"bytes"
"errors"
"io"
Expand All @@ -22,15 +23,22 @@ func newConn(cmd *exec.Cmd) (_ conn, err error) {

out, err := cmd.StdoutPipe()
stdErr := &tailBuffer{limit: 1024}
c := conn{out, in, stdErr, cmd}
buff := bufio.NewReader(out)
c := conn{buff, buff, out, in, stdErr, cmd}
cmd.Stderr = c.stdErr

return c, err
}

// conn wraps a ReadCloser, WriteCloser, and a Cmd.
type byteReadWriteCloser interface {
io.ReadWriteCloser
io.ByteReader
}

type conn struct {
io.ReadCloser
io.ByteReader
io.Reader
readerCloser io.Closer
io.WriteCloser
stdErr *tailBuffer
cmd *exec.Cmd
Expand All @@ -48,7 +56,7 @@ func (c conn) Start() error {
// Close closes conn's WriteCloser, ReadClosers, and waits for the command to finish.
func (c conn) Close() error {
writeErr := c.WriteCloser.Close()
readErr := c.ReadCloser.Close()
readErr := c.readerCloser.Close()
cmdErr := c.waitWithTimeout()

if writeErr != nil {
Expand Down
1 change: 0 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:x
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.1 h1:ZFgWrT+bLgsYPirOnRfKLYJLvssAegOj/hgyMFdJZe0=
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
Expand Down
6 changes: 6 additions & 0 deletions internal/embeddedsass/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

* Install protobuf: https://github.com/protocolbuffers/protobuf
* Install the Go plugin: go get -u google.golang.org/protobuf/cmd/protoc-gen-go
* Download the correct version of the proto file: https://github.com/sass/embedded-protocol/blob/master/embedded_sass.proto
* protoc --go_out=. embedded_sass.proto
* Fix package name in embedded_sass.pb.go (TODO(bep))

0 comments on commit 28e22de

Please sign in to comment.