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

Stdout not working anymore after fuse_main invocation #1209

Open
3 of 5 tasks
Jakz opened this issue Apr 18, 2024 · 1 comment
Open
3 of 5 tasks

Stdout not working anymore after fuse_main invocation #1209

Jakz opened this issue Apr 18, 2024 · 1 comment

Comments

@Jakz
Copy link

Jakz commented Apr 18, 2024

Environment

  • Windows version: Windows 10
  • Processor architecture: amd64
  • Dokany version: 2.1.0
  • Library type (Dokany/FUSE): FUSYE

Check List

  • I checked my issue doesn't exist yet
  • My issue is valid with mirror default sample and not specific to my user-mode driver implementation
  • I can always reproduce the issue with the provided description below.
  • I have updated Dokany to the latest version and have reboot my computer after.
  • I tested one of the last snapshot from appveyor CI

Description

I'm not sure this is intended behavior or if I'm missing something obvious but I'm trying to implement my own FUSE to provide custom behavior.
To do this I need to debug a lof of interactions which is done with std::cout or printf but neither of them are working after fuse_main. My application is currently a console application and I'm running it through MSVC2022.

It looks like fuse_main is doing something which prevents any output from reaching stdout. I thought it could be an issue of which thread is actually calling the out function (since I have them in the fuse_operations callback) but I'm not able to print anything even from main thread (I tried with a non-blocking fuse_main and a string buffer to pass messages between threads).

@Liryna
Copy link
Member

Liryna commented Apr 18, 2024

Have you tried with -f ? Otherwise the instance is detach from the console

FUSE_HELPER_OPT("-f", foreground),

int fuse_daemonize(int foreground)
{
if (!foreground) {
#ifdef __CYGWIN__
int res = daemon(0, 0);
if (res == -1) {
perror("fuse: failed to daemonize program\n");
return -1;
}
#else
/** No daemons on Windows but we detach from current console **/
if (FreeConsole() == 0) {
DWORD currentError = GetLastError();
fprintf(stderr, "fuse: daemonize failed = %lu\n", currentError);
return -1;
}
#endif
}
return 0;
}

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

2 participants