Skip to content

add forward_stdin test option #3186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

add forward_stdin test option #3186

wants to merge 2 commits into from

Conversation

t-bltg
Copy link
Contributor

@t-bltg t-bltg commented Aug 30, 2022

Fix #3185.

Should be backported to 1.8.

@fredrikekre
Copy link
Member

Wouldn't it be better to setup your own stdin that you control instead?

@t-bltg
Copy link
Contributor Author

t-bltg commented Aug 30, 2022

Wouldn't it be better to setup your own stdin that you control instead?

How can I do that ? AFAIK there is now way to recover the parent stdin fd from the child process when the parent runs asynchronously (wait=false). We need the terminal stdin to parse terminal replies to escape sequences - being written to the parent stdin.

import Base: TTY

main() = begin
  script = """
  import Base: TTY

  println("== child ==")
  @show stdin stdin isa TTY

  # recover parent stdin fd ?
  """
  @show stdin stdin isa TTY Base._fd(stdin)
  run(pipeline(`$(Base.julia_cmd()) -e $script`, stdout=stdout, stderr=stderr), wait=false) |> wait  # mimic src/Operations.jl
  return
end

main()

output

stdin = TTY(RawFD(10) open, 0 bytes waiting)
stdin isa TTY = true
Base._fd(stdin) = RawFD(10)
== child ==
stdin = IOStream(<fd 9>)
stdin isa TTY = false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

stdin closed / unavailable during testing
2 participants