TechieGuy12 / PlexServerAutoUpdater

Automatically update Plex when running the Plex service.
MIT License
118 stars 10 forks source link

Exit Code 0 Returned When Running Silent as Non-Administrator #33

Open Hossy opened 5 years ago

Hossy commented 5 years ago

https://github.com/TechieGuy12/PlexServerAutoUpdater/blob/651d6a431c20634decb3130471b1b631e232dd4d/Program.cs#L73

psupdate.exe -silent && echo success || echo fail returns success in a non-elevated command prompt on Windows Server 2012 R2.

The contents of the log file are: 2019-05-30 19:01:46 Getting windows user. 2019-05-30 19:01:46 Checking if user is an administrator.

Hossy commented 5 years ago

Additionally, I would like to suggest moving line 61 and line 70 outside the if (!isSilent) block so the error can be logged.

TechieGuy12 commented 5 years ago

Thanks for the catch. The fix should be available in 0.1.8.6-beta.1.

Hossy commented 5 years ago

0.1.8.6-beta.1 fixes the logging issue, but the exit code is still 0.

C:\Program Files (x86)\PlexServerAutoUpdater>psupdate -silent

C:\Program Files (x86)\PlexServerAutoUpdater>echo %errorlevel%
0

C:\Program Files (x86)\PlexServerAutoUpdater>psupdate.exe -silent && echo success || echo fail
success

psupdate.exe -silent && echo success || echo fail returns success in a non-elevated command prompt on Windows Server 2012 R2.

TechieGuy12 commented 5 years ago

The release [0.1.8.6-beta.2]https://github.com/TechieGuy12/PlexServerAutoUpdater/releases/tag/0.1.8.6-beta.2 should fix the errorlevel issue.

Hossy commented 5 years ago

Error code is still 0.

C:\Program Files (x86)\PlexServerAutoUpdater>psupdate -silent

C:\Program Files (x86)\PlexServerAutoUpdater>echo %errorlevel%
0

C:\Program Files (x86)\PlexServerAutoUpdater>psupdate.exe -silent && echo success || echo fail
success
Hossy commented 5 years ago

Just wondering if you've had a chance to look at this

Hossy commented 4 years ago

Just checking back in on this. :-) I really appreciate you writing this tool. It's been a life saver for my system!