No console output in v2.0.3.7

In Duplicati v2.0.3.7, the commandline utilities no longer return any output. I guess “Removed all calls to Console.WriteLine as it could lock up the console on Windows” from the release notes is responsible for this behaviour.
Is this a temporary fix to prevent lockups, a permanent change of just a bug?

I hope the commandline tools will report back results in one of the next versions, because even Duplicati.CommandLine.exe help advanced doesn’t show any information.

As a workaround, I use the help command from the CommandLine item in the Web UI.

This doesn’t sound intentional :face_with_raised_eyebrow:. @kenkendk

That’s strange. Duplicati.CommandLine.exe help advanced prints out a bunch of information for me (2.0.3.7 on Linux).

In that case I guess it’s a Windows-only issue.

Duplicati v2.0.3.6:

Duplicati v2.0.3.7:
image

This is happening for any console output.
However, from the Web UI, everything works as expected:

Certainly not intentional!

That commit is:

It should not have an impact, because it just avoid writing error messages to stdout, and writes them to the log instead.

My best guess is that this commit did not work as expected:

This was part of a PR from @verhoek:

The idea was that stdout would automatically be redirected when the child process is started with UseShellExecute = false as explained here:
https://csharp.today/how-to-run-child-process-in-the-same-console-in-c/

According to that documentation, the child process should just send the output.

@kees-z & @warwickmm are you running with the auto-updater disabled? If the auto-updater is disabled, it will not make a child process, which could muddy the testing.

If I’m not mistaken, once the autoupdate is disabled, it will not hit the code I changed and will run “normally” without any console sharing. If that is so, it is something else.

For both 2.0.3.6 and 2.0.3.7, I downloaded the Zip version, extracted the zip and executed Duplicati.CommandLine.exe help advanced from the extracted folder.

For the 2.0.3.7 version, I started the server with Duplicati.Server.exe --webservice-port=8500 --portable-mode, created a test job in the Web UI and launched the help command using the Commandline menu of the test job.

I just tested this on a Windows machine, and if the autoupdater is disabled, output is sent correctly, so it has to do with not redirecting the console back from the child process.

In that case, it seems likely it’s from my commit. Can you try to re add the stdout/stderr stream redirects, but not stdin, and see what happens on Windows? Redirecting stdin breaks it on Linux as we saw. Hopefully not redirecting stdin also works on Windows.

Sadly no…

I also tried to use this method, which should do it, but I cannot get it to work correctly:

Instead, I am working on a solution where the Linux is using the automatic redirect and Windows is using manual forwards and a workaround for reading the passphrase.

That sounds reasonable, although it would be nice to have something uniform. I don’t have time to look into it right now, though my fingers are itching :smile: From the C# Today link you’d say it should’ve worked on windows, the screenshots on that page are from Windows and display the desired behavior.

Exactly. You said “works on Linux” and the page shows Windows terminals, so I did not expect any problems.

I ended up with this fix:

I read the change. So on Windows in ReadPassphraseFromConsole throws an InvalidOperation exception, by
probably Console.ReadKey? Though Console.Readline works fine in the ReadPassphraseFromStdin? Strange.

Yes, the Console.ReadKey() reads from the keyboard, not stdin. If the console is redirected, the method throws InvalidOperationException. We can read from Console.ReadLine(), as that just returns a line from stdin. Downside is that we cannot mask the input, but for now, I think this is a better solution than having a broken password input.

It seems that on linux the output isn’t completely correct either, some output lines are missing. Like what’s actually happening. Only progress reports are printed.

I did increase console-log-level, let’s see if that makes any difference.

Totally off-topic request, just to think about.
I would LOVE to see option, where output would show files and number of blocks (or whole files) being added, replaced, removed.

I hope that is fixed in 2.0.3.8, where the console handling is done slightly different.

That requires some console magic, probably implemented with ncurses or similar: GitHub - mono/mono-curses: Mono/.NET bindings to the Unix Curses as well as GUI framework for creating text applications with Curses

With something like this, it is a matter of updating the display, as all the information is already reported, but just not printed.

Now that 2.0.3.8 is out, please let us know if updating to it resolves the console output issue.

2 Likes

Looks good in 2.0.3.8. For me, all commandline tools are working.

1 Like

Yes, same here. LGTM.