Skip to content
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

ignore output of program - flush directly to terminal #11512

Open
J-Cake opened this issue Jan 9, 2024 Discussed in #11471 · 5 comments
Open

ignore output of program - flush directly to terminal #11512

J-Cake opened this issue Jan 9, 2024 Discussed in #11471 · 5 comments

Comments

@J-Cake
Copy link

J-Cake commented Jan 9, 2024

Discussed in #11471

Originally posted by J-Cake January 2, 2024
Hey, when set up, qemu can connect its stdio to a TTY on guest. This is epic because it allows you to interact with the guest via a standard terminal much like how SSH would. However, (my understanding) nushell attempts to parse the output in some way, and buffers it. This causes the output of Qemu to freeze until the process exists. At this point the buffer is flushed and I see everything. I'm hoping to instruct nushell to just leave it be for this one command so I don't have to drop back to bash. Any tips?


My QEMU command is:

def main [
    --bios: path = "/usr/share/OVMF/OVMF_CODE.fd",
    --drive: path = "*redox*.qcow2"
    --mem: int = 8,
    --cpu_cores: int = 8,
] {
    (
        qemu-system-x86_64
            --enable-kvm
            --name "Redox OS"
            --machine q35
            # --display egl-headless,rendernode=/dev/dri/card0,
            --display sdl
            -k de

            -m $"($mem)G" #Mem

            -cpu host -smp $cpu_cores #CPU

            # -drive $"if=pflash,format=raw,readonly=on,file=($bios)" # Bios

            -blockdev $"qcow2,node-name=nvme0,file.driver=file,file.filename=(glob $drive | first)" # Storage File
            -device nvme,drive=nvme0,serial=deadbeef1 # Storage Controller

            -device virtio-gpu-pci # Display

            -device virtio-net,netdev=net0 -netdev user,id=net0 # Network

            -device nec-usb-xhci,id=xhci # USB

            -chardev stdio,id=debug,signal=on,mux=on # TTY
            -serial chardev:debug # Debug
            --mon chardev=debug # Monitor

    )
}

The BASH code I translated from it is

qemu-system-x86_64 --enable-kvm --name "Redox OS" --machine q35 --display sdl -k de -m 8G -cpu host -smp 8 \
    -blockdev qcow2,node-name=nvme0,file.driver=file,file.filename=/home/jcake/Erika/redox.qcow2 \
     -device nvme,drive=nvme0,serial=deadbeef1 \
     -device virtio-gpu-pci \
     -device virtio-net,netdev=net0 -netdev user,id=net0 \
     -device nec-usb-xhci,id=xhci \
     -chardev stdio,id=debug,signal=off,mux=on -serial chardev:debug \
     --mon chardev=debug

Accounting for manual variable substitution, the two commands are identical. One works in Bash, and the other doesn't work in nushell...

I'm promoting this to an issue since I get the impression this is not desired behaviour. I'm still struggling with this issue and would sincerely appreciate help

@fdncred
Copy link
Collaborator

fdncred commented Jan 9, 2024

I don't use qemu so it's hard to tell. I'm guessing it could be something with how nushell communicates on stdout with the pipeline.

@nibon7
Copy link
Contributor

nibon7 commented Jan 10, 2024

What's your nushell version? @J-Cake

I don't see any difference between bash and nushell with these options -chardev stdio,id=debug,signal=off,mux=on -serial chardev:debug --mon chardev=debug.

@J-Cake
Copy link
Author

J-Cake commented Jan 10, 2024

What's your nushell version? @J-Cake

I don't see any difference between bash and nushell with these options -chardev stdio,id=debug,signal=off,mux=on -serial chardev:debug --mon chardev=debug.

Yep. That's precisely my point. There isn't a difference. Therefore it must be an issue with nushell. Conveniently, I'm at work at the moment, and likely won't be home until much later, but I'll let you know as soon as I can. Cheers

@nibon7
Copy link
Contributor

nibon7 commented Jan 10, 2024

Both bash and nushell work well on my pc.

qemu-system-x86_64 \
--enable-kvm \
-cpu host \
-machine pc \
-kernel vmlinuz-6.7.0 \
-initrd initrd.zst \
-append 'console=ttyS0 loglevel=8 root=/dev/ram0' \
-chardev stdio,id=debug,signal=off,mux=on \
-serial chardev:debug \
--mon chardev=debug

@J-Cake
Copy link
Author

J-Cake commented Jan 10, 2024

That is very curious... It consistently doesn't work on mine...

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

No branches or pull requests

3 participants