Skip to content

Commit

Permalink
Update tools for new IO. (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
floitsch committed Apr 8, 2024
1 parent ecd9423 commit 19c8367
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 19 deletions.
6 changes: 3 additions & 3 deletions tools/git.toit
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this from code is governed by an MIT-style license that can be
// found in the LICENSE_MIT file.
import bytes
import io
import host.pipe
import monitor
import cli show Ui
Expand Down Expand Up @@ -181,8 +181,8 @@ class Git:
return run_ args --description="Git command"

run_ args/List --description -> string:
output := bytes.Buffer
stdout := bytes.Buffer
output := io.Buffer
stdout := io.Buffer
fork_data := pipe.fork
--environment=git_env_
true // use_path
Expand Down
28 changes: 19 additions & 9 deletions tools/package.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
sdk: ^2.0.0-alpha.79
sdk: ^2.0.0-alpha.144
prefixes:
certificate_roots: toit-cert-roots
cli: pkg-cli
Expand All @@ -8,20 +8,30 @@ packages:
pkg-cli:
url: github.com/toitlang/pkg-cli
name: cli
version: 1.2.0
hash: 0e2adab3ab434c597be60438ccf64008f703ad9c
version: 1.8.0
hash: 73c8aabb60a6f5f304566a1e781d7b025aa17e9b
prefixes:
fs: pkg-fs
host: pkg-host
pkg-fs:
url: github.com/toitlang/pkg-fs
name: fs
version: 2.2.0
hash: 863280c5c62ac259d16d0d3b24df21209b461b14
prefixes:
host: pkg-host
pkg-host:
url: github.com/toitlang/pkg-host
name: host
version: 1.9.0
hash: 76e4dc5328a5c3739e97f65ed196d05058071359
version: 1.15.1
hash: ff187c2c19d695e66c3dc1d9c09b4dc6bec09088
pkg-http:
url: github.com/toitlang/pkg-http
name: http
version: 2.3.0
hash: 05ce2065a75813138d2c4ca1bab03e7a6f0541a2
version: 2.7.0
hash: ba6a3c73462aa8a3baae47881e9b2349725c22c3
toit-cert-roots:
url: github.com/toitware/toit-cert-roots
name: certificate_roots
version: 1.5.0
hash: 27a9f9ff3d337b6128e98e220126e3cc275bcd73
version: 1.6.1
hash: 55d3be82ed53d8d332338b2de931865cf69fe48b
8 changes: 4 additions & 4 deletions tools/package.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
dependencies:
certificate_roots:
url: github.com/toitware/toit-cert-roots
version: ^1.5.0
version: ^1.6.1
cli:
url: github.com/toitlang/pkg-cli
version: ^1.2.0
version: ^1.8.0
host:
url: github.com/toitlang/pkg-host
version: ^1.9.0
version: ^1.15.1
http:
url: github.com/toitlang/pkg-http
version: ^2.3.0
version: ^2.7.0
4 changes: 1 addition & 3 deletions tools/utils.toit
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import host.directory
import host.file
import host.os
import host.pipe
import writer
import system show platform PLATFORM_WINDOWS

with_tmp_directory [block]:
Expand All @@ -20,8 +19,7 @@ copy_file --from/string --to/string:
in_stream := file.Stream.for_read from
out_stream := file.Stream.for_write to
try:
writer := writer.Writer out_stream
writer.write_from in_stream
out_stream.out.write_from in_stream.in
// TODO(florian): we would like to close the writer here, but then
// we would get an "already closed" below.
finally:
Expand Down

0 comments on commit 19c8367

Please sign in to comment.