Skip to content

Commit

Permalink
Cleanup for release
Browse files Browse the repository at this point in the history
  • Loading branch information
cmoog committed Jul 1, 2020
1 parent 1d9fe35 commit 5d2bff0
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 24 deletions.
17 changes: 0 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,20 +89,3 @@ $ head -c 100000000 /dev/urandom > /tmp/random; cat /tmp/random | pv | time sh
95.4MiB 0:00:00 [1.73GiB/s] [ <=> ]
sh -c "cat > /dev/null" 0.00s user 0.02s system 32% cpu 0.057 total
```

### Performance Goals

Test command

```shell script
head -c 100000000 /dev/urandom > /tmp/random; cat /tmp/random | pv | time coder sh ammar sh -c "cat > /dev/null"
```

streams at

```shell script
95.4MiB 0:00:08 [10.7MiB/s] [ <=> ]
15.34 real 2.16 user 1.54 sys
```

The same command over wush stdout (which is high performance) streams at 17MB/s.
2 changes: 1 addition & 1 deletion client.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func (r remoteProcess) listen(ctx context.Context) {
select {
case exitCode := <-exitCode:
if exitCode != 0 {
r.done <- ExitError{Code: int(exitCode)}
r.done <- ExitError{Code: exitCode}
return
}
r.done <- nil
Expand Down
4 changes: 2 additions & 2 deletions exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ func (e ExitError) Error() string {

// Process represents a started command.
type Process interface {
// Pid is populated immediately during a successfull start with the process ID.
// Pid is populated immediately during a successful start with the process ID.
Pid() int
// Stdout returns an io.WriteCloser that will pipe writes to the remote command.
// Closure of stdin sends the correspoding close messsage.
// Closure of stdin sends the corresponding close message.
Stdin() io.WriteCloser
// Stdout returns an io.Reader that is connected to the command's standard output.
Stdout() io.Reader
Expand Down
2 changes: 1 addition & 1 deletion internal/proto/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Protocol

Each Message is represented as a single WebSocket message. A newline character separates a JSON header from the binary body.
Each message is represented as a single WebSocket message. A newline character separates a JSON header from the binary body.

Some messages may omit the body.

Expand Down
3 changes: 2 additions & 1 deletion internal/proto/protocol_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ func TestWithHeader(t *testing.T) {
for _, tcase := range tests {
b := bytes.NewBuffer(nil)
withheader := WithHeader(b, []byte(tcase.inputheader))
withheader.Write([]byte(tcase.inputbody))
_, err := withheader.Write([]byte(tcase.inputbody))
assert.Success(t, "write to buffer with header", err)

msg, err := ioutil.ReadAll(b)
assert.Success(t, "read buffer", err)
Expand Down
4 changes: 2 additions & 2 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func Serve(ctx context.Context, c *websocket.Conn, execer Execer) error {
}
}

func sendExitCode(ctx context.Context, exitCode int, conn net.Conn) error {
func sendExitCode(_ context.Context, exitCode int, conn net.Conn) error {
header, err := json.Marshal(proto.ServerExitCodeHeader{
Type: proto.TypeExitCode,
ExitCode: exitCode,
Expand All @@ -134,7 +134,7 @@ func sendExitCode(ctx context.Context, exitCode int, conn net.Conn) error {
return err
}

func sendPID(ctx context.Context, pid int, conn net.Conn) error {
func sendPID(_ context.Context, pid int, conn net.Conn) error {
header, err := json.Marshal(proto.ServerPidHeader{Type: proto.TypePid, Pid: pid})
if err != nil {
return err
Expand Down

0 comments on commit 5d2bff0

Please sign in to comment.