Beehaw
  • Communities
  • Create Post
  • search
    Search
  • Login
  • Sign Up
TadoTheRustacean ( TadoTheRustacean@programming.dev )  to Programmer Humor@programming.devEnglish · 3 years ago

thisIsGoingToBeASeriousDebate

programming.dev

message-square
33
link
fedilink
200

thisIsGoingToBeASeriousDebate

programming.dev

TadoTheRustacean ( TadoTheRustacean@programming.dev )  to Programmer Humor@programming.devEnglish · 3 years ago
message-square
33
link
fedilink
  • 30p87 ( 30p87@feddit.de ) 
    link
    fedilink
    arrow-up
    33
    ·
    3 years ago

    Personally,

    echo Hello World!
    
    • fable (she/they) ( pranaless@beehaw.org ) 
      link
      fedilink
      arrow-up
      31
      ·
      3 years ago
      use std::process::Command;
      
      fn main() {
          Command::new("sh")
              .arg("-c")
              .arg("echo Hello World!")
              .spawn()
              .unwrap();
      }
      

      Like this?

      • 30p87 ( 30p87@feddit.de ) 
        link
        fedilink
        arrow-up
        10
        ·
        3 years ago

        No, more like

        use std::process::Command; fn main() { Command::new("sh").arg("-c").arg("echo Hello World!").spawn().unwrap(); }
        

        .
        Just a little bit shorter, as it seems /s

        • funkajunk ( funkajunk@lemm.ee ) 
          link
          fedilink
          English
          arrow-up
          8
          ·
          3 years ago

          I just fucking threw up

          • 30p87 ( 30p87@feddit.de ) 
            link
            fedilink
            arrow-up
            6
            ·
            3 years ago

            I did too. Multiple times in fact, I had to look at the other Rust code!

        • TadoTheRustacean ( TadoTheRustacean@programming.dev ) OP
          link
          fedilink
          arrow-up
          2
          ·
          3 years ago

          Isn’t echo a shell builtin?

          • fable (she/they) ( pranaless@beehaw.org ) 
            link
            fedilink
            arrow-up
            1
            ·
            3 years ago

            Yes and no. While coreutils does provide an echo binary, shells also have a built-in for optimisation purposes.

            At first I had the code calling the binary directly, but then changed it to spawning a shell (and so using the builtin). It’s very cursed either way.

Programmer Humor@programming.dev

programmer_humor@programming.dev

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programmer_humor@programming.dev

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics
    • If the mod doesn’t find it funny, you’re banned. Ha-ha!.. For real: do not use the community for “statements”. There are other places for such content. Keep it chill and funny.
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 267 users / day
  • 2.56K users / week
  • 5.21K users / month
  • 8.27K users / 6 months
  • 463 local subscribers
  • 33.9K subscribers
  • 1.62K Posts
  • 26.8K Comments
  • Modlog
  • mods:
  • Feyter ( Feyter@programming.dev ) 
  • adr1an ( anzo@programming.dev ) 
  • BurningTurtle ( BurningTurtle@programming.dev ) 
  • Pierre-Yves Lapersonne ( pylapp@programming.dev ) 
  • BE: 0.19.15
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code