The words Under construction in black text on a yellow background with diagonal black stipes surrounding it
I'm in the process of moving my site. It's still a work in progress. Please excuse the mess and broken links.

Get The Text Output From An External Command In Rust

TODO: Pull subtitle into page object
Code
use std::process::Command;

fn main() {
    let args = vec!["-l"];
    let response = Command::new("ls")
        .args(args)
        .output()
        .expect("did not work");
    let text = String::from_utf8_lossy(&response.stdout);
    dbg!(text);
}

Notes

Debugging Stuff

I'm moving stuff around right now. All this below is helping me figure out where to put stuff

        -- title

Get The Text Output From An External Command In Rust

-- code

use std::process::Command;

fn main() {
    let args = vec!["-l"];
    let response = Command::new("ls")
        .args(args)
        .output()
        .expect("did not work");
    let text = String::from_utf8_lossy(&response.stdout);
    dbg!(text);
}


-- notes

- The default that comes back from output is a `Vec-u8-``
that has to be turned into a string to output it if you 
want to see it as letters. 

- I wouldn't be surprised to find other ways to do this.


-- categories
-- Rust 
-- Command Line 

-- metadata
-- date: 2023-04-07 17:32:57
-- id: 2o7en9t0
-- site: aws
-- type: post
-- status: published