about summary refs log tree commit diff
diff options
context:
space:
mode:
authorsterni <sternenseemann@systemli.org>2021-09-14T21·47+0200
committersterni <sternenseemann@systemli.org>2021-09-15T12·28+0000
commit529ac7fd12633ec93b04ee4125dc4f9abd1c1b60 (patch)
tree357c3a629a41daf156e58275cf332aa42b6a3570
parent391a186d2751ee8500976e8bd60dc6feecf75a92 (diff)
refactor(nix/nint): use stdout().write_all() over print!() r/2862
Change-Id: Ic372442c5156f1e13fea28c1b3e57d64e89ba49b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3546
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
-rw-r--r--nix/nint/nint.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/nix/nint/nint.rs b/nix/nint/nint.rs
index 3d430612851a..823de4865565 100644
--- a/nix/nint/nint.rs
+++ b/nix/nint/nint.rs
@@ -3,7 +3,7 @@ extern crate serde_json;
 use serde_json::Value;
 use std::ffi::OsString;
 use std::os::unix::ffi::{OsStringExt, OsStrExt};
-use std::io::{Error, ErrorKind, Write};
+use std::io::{Error, ErrorKind, Write, stdout, stderr};
 use std::process::Command;
 
 fn render_nix_string(s: &OsString) -> OsString {
@@ -99,10 +99,10 @@ fn main() -> std::io::Result<()> {
                           .output()?;
 
         match serde_json::from_slice(&run.stdout[..]) {
-            Ok(Value::String(s)) => Ok(print!("{}", s)),
+            Ok(Value::String(s)) => stdout().write_all(s.as_bytes()),
             Ok(_) => Err(Error::new(ErrorKind::Other, "output must be a string")),
             _ => {
-                std::io::stderr().write_all(&run.stderr[..]);
+                stderr().write_all(&run.stderr[..]);
                 Err(Error::new(ErrorKind::Other, "internal nix error"))
             },
         }