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

when FFmpeg wasix build exit, the OS prompt is not restored properly #4104

Closed
ptitSeb opened this issue Jul 25, 2023 · 1 comment
Closed
Assignees
Labels
priority-medium Medium priority issue
Milestone

Comments

@ptitSeb
Copy link
Contributor

ptitSeb commented Jul 25, 2023

Describe the bug

Using the ffmpeg wasix build, like with wasmer run wasmer/ffmpeg --mapdir /src:. -- -i /src/a.mp4 /src/a.avi will do the coversion, but when it's over, the program is like it's waiting for an input, while it's over. The OS prompt is not showing.

Steps to reproduce

wasmer run wasmer/ffmpeg --mapdir /src:. -- -i /src/a.mp4 /src/a.av

with a.mp4 existing...

Expected behavior

Prompt showing at this end of the conversion

Actual behavior

Prompt not showing at the end of the conversion

Additional context

@ptitSeb ptitSeb self-assigned this Jul 25, 2023
@ptitSeb ptitSeb added the priority-medium Medium priority issue label Jul 25, 2023
@ptitSeb ptitSeb added this to the v4.1.1 milestone Jul 25, 2023
@ptitSeb
Copy link
Contributor Author

ptitSeb commented Jul 26, 2023

@john-sharratt Here is a way to reproduce the issue with a more minimum sample:
create main.c with

#include <stdio.h>
#include <unistd.h>
#include  <sys/time.h>

static int read_key()
{
    int ch;
    int n = 1;
    struct timeval tv;
    fd_set rfds;

    FD_ZERO(&rfds);
    FD_SET(0, &rfds);
    tv.tv_sec = 0;
    tv.tv_usec = 0;
    return select(1, &rfds, NULL, NULL, &tv);
}

int main(int argc, const char* argv[])
{
  int ch = read_key();
  printf("key = %d, bye\n", ch);
}

Build with

clang-15 --target=wasm32-wasi --sysroot=/home/seb/wasix-libc/sysroot32 -matomics -mbulk-memory -mmutable-globals -pthread -mthread-model posix -ftls-model=local-exec -fno-trapping-math -D_WASI_EMULATED_MMAN -D_WASI_EMULATED_SIGNAL -D_WASI_EMULATED_PROCESS_CLOCKS -O2 -g -flto -Wl,--shared-memory -Wl,--max-memory=4294967296 -Wl,--import-memory -Wl,--export-dynamic -Wl,--export=__heap_base -Wl,--export=__stack_pointer -Wl,--export=__data_end -Wl,--export=__wasm_init_tls -Wl,--export=__wasm_signal -Wl,--export=__tls_size -Wl,--export=__tls_align -Wl,--export=__tls_base -lwasi-emulated-mman -O2 -flto -g  main.c -o main.wasm

path/version to clang and path to sysroot need to be adapted of course.

Native version can be built with a simple gcc main.c -o main

The native version exit immediatly with

key = 0, bye

While the wasm version wait for a keypress.

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

No branches or pull requests

1 participant