Beehaw
  • Communities
  • Create Post
  • search
    Search
  • Login
  • Sign Up
einfach_orangensaft ( einfach_orangensaft@feddit.de )  to Programmer Humor@lemmy.ml · 3年前

it writes to output to the terminal or it gets the SIGTERM again

feddit.de

message-square
9
link
fedilink
100

it writes to output to the terminal or it gets the SIGTERM again

feddit.de

einfach_orangensaft ( einfach_orangensaft@feddit.de )  to Programmer Humor@lemmy.ml · 3年前
message-square
9
link
fedilink
  • einfach_orangensaft ( einfach_orangensaft@feddit.de ) OP
    link
    fedilink
    arrow-up
    18
    ·
    3年前

    Context:

    I have 2 Terminals open, in one is a Python Terminal Chat client running(pt3). I want to sent text from the other terminal(pt2) to the chat. It does write the text to pt3 but pt3 dosent ‘see’ the text.

    If i send over “hallo world” it prints on the terminal but dosent show up in chat.

    github of the python termina terminal chat

    • BeigeAgenda ( BeigeAgenda@lemmy.ca ) 
      link
      fedilink
      arrow-up
      11
      ·
      3年前

      My first thought was, can you flush the buffer?

    • Programmer Belch ( programmer_belch@lemmy.dbzer0.com ) 
      link
      fedilink
      English
      arrow-up
      10
      ·
      3年前

      Just guessing here but could it be because you haven’t set up correctly pt2 as stdin for pt3, try to invoke the command as

      script.py 
    • dblsaiko ( 2xsaiko@discuss.tchncs.de ) 
      link
      fedilink
      arrow-up
      8
      ·
      3年前

      A PTS is a single character device. Writing to it causes output to appear on the terminal buffer, reading from it reads from the input buffer. So, writing to it like you do from a separate shell effectively does the same as calling print() from python which has it as inherited stdio. There is a way to write to a PTS input buffer but it’s not straightforward and works in a completely different way. Use something like tmux instead, or better, sockets.

      • einfach_orangensaft ( einfach_orangensaft@feddit.de ) OP
        link
        fedilink
        arrow-up
        2
        ·
        3年前

        thank you!

        tmux did thr tick for me

    • navigatron ( navigatron@beehaw.org ) 
      link
      fedilink
      arrow-up
      3
      ·
      3年前

      Time to dive into the wide world of VTTYs. I believe you’re writing to pts3’s output buffer - writing to its input buffer is a different virtual device / may be a process descriptor, I’m not sure. Look into the history of vttys and it should start to make sense.

Programmer Humor@lemmy.ml

programmerhumor@lemmy.ml

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: !programmerhumor@lemmy.ml

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.
Visibility: Public
globe

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

  • 1 user / day
  • 41 users / week
  • 302 users / month
  • 1.79K users / 6 months
  • 871 local subscribers
  • 43.7K subscribers
  • 1.25K Posts
  • 10.3K Comments
  • Modlog
  • mods:
  • AgreeableLandscape ( AgreeableLandscape@lemmy.ml ) 
  • cat_programmer ( cat_programmer@lemmy.ml ) 
  • BE: 0.19.15
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code