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

UI-based programs are not shown up after executed by a Custom Command task on Windows Agents #9990

Closed
dgtvan opened this issue Dec 26, 2021 · 4 comments

Comments

@dgtvan
Copy link

dgtvan commented Dec 26, 2021

Issue Type
  • Bug Report
Summary

I have a command task to execute a command which executes another program.
The command is executed successfully, the program is started/running successfully but its windows/UI is not shown up.

Environment
Basic environment details
  • Go Version: 21.2.0 (12498-16e1ac6956cd5177a99dc3fe33503661881c354f).
  • JAVA Version: 15.0.2
  • OS: Windows 10 10.0
Additional Environment Details
Steps to Reproduce

Create a Custom Command task with the following details:

  • Command: start
  • Arguments: "InstanceReference" /d "D:\Apps\InstanceReference" InstanceReference.exe

image

Expected Results

InstanceReference.exe will be running and showing up with a window.

Actual Results

InstanceReference.exe was running but its window did NOT show up.

image
image

Possible Fix

N/A

Log snippets
Code snippets/Screenshots

There was no error or exception.

image

Any other info
  • InstanceReference.exe is a UI program built with .NET Core 3.1. It has no problem if I execute the exact same command with cmd by myself. The program is executed successfully and its main window shows up normally.

  • I tried with a different program Calc which is a built-in calculator on Windows. The issue also happened.

  • I believe the problem is somewhere on the way the command proceeded, I do not know how Java so I can not go further.

@chadlwilson
Copy link
Member

Did you install the agent via the installer, and is it running as a service? If so, the agent will probably be running as SYSTEM, not as your normal login user (I don't know the history of why the services are installed as SYSTEM rather than current user).

If you want to see a UI while jobs/tasks are running, you will probably need the agent to be running as your current user.

To do so, you could either

  • play around with changing which user the agent service runs as. I'm not sure the consequences of this, and it seems likely there will be issues with folders or files your user account needs access to that only SYSTEM has access to with the default installer. I am not sure on this part though - you could experiment.
  • instead of using the installer/service, run the agent as a generic zip with bin/go-agent.bat. You'd need a Java runtime environment 13-15 installed and on the path or with JAVA_HOME specified but can run it anywhere.

@arvindsv
Copy link
Member

Yes, @chadlwilson's response is right. There is some documentation mentioning this, but it is likely out of date (Windows menus, startup etc): https://docs.gocd.org/current/advanced_usage/ui_testing.html

I would suggest going with the second option as well.

@dgtvan
Copy link
Author

dgtvan commented Dec 28, 2021

I made it work as expected.
@chadlwilson's response is right.
Thank you @chadlwilson and @arvindsv .

@dgtvan dgtvan closed this as completed Dec 28, 2021
@dgtvan
Copy link
Author

dgtvan commented Dec 29, 2021

For those who are curious to know what the root problem is, read the following references:
1/ https://stackoverflow.com/questions/11549881/java-service-wrapper-to-create-service-for-java-ui-application
2/ https://wrapper.tanukisoftware.com/doc/english/prop-ntservice-interactive.html

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