u3d icon indicating copy to clipboard operation
u3d copied to clipboard

u3d run does not tail/print Editor.log

Open creativitRy opened this issue 5 years ago • 1 comments

Issue Checklist

  • [x] I'm using the latest u3d version
  • [x] I ran u3d --help
  • [x] I read the README
  • [x] I made sure that a similar issue doesn't exit

Issue Description

Hello, we're trying to run u3d to execute our build command. Editor.log is not printed to the terminal.

Here's what is printed:

$ C:/Ruby27-x64/bin/u3d.bat run -- -executeMethod CloudCanards.Core.Editor.Cli.CloudCanardsBuilder.Build -quit -batchmode --trace
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/u3d-1.2.3/lib/u3d/installation.rb:350: warning: Win32API is deprecated after Ruby 1.9.1; use fiddle directly instead
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/u3d-1.2.3/lib/u3d/installation.rb:409: warning: Win32API is deprecated after Ruby 1.9.1; use fiddle directly instead
C:/Ruby27-x64/lib/ruby/2.7.0/win32api.rb:10: warning: already initialized constant Win32API::DLL
C:/Ruby27-x64/lib/ruby/2.7.0/Win32API.rb:10: warning: previous definition of DLL was here
C:/Ruby27-x64/lib/ruby/2.7.0/win32api.rb:11: warning: already initialized constant Win32API::TYPEMAP
C:/Ruby27-x64/lib/ruby/2.7.0/Win32API.rb:11: warning: previous definition of TYPEMAP was here
C:/Ruby27-x64/lib/ruby/2.7.0/win32api.rb:12: warning: already initialized constant Win32API::POINTER_TYPE
C:/Ruby27-x64/lib/ruby/2.7.0/Win32API.rb:12: warning: previous definition of POINTER_TYPE was here
C:/Ruby27-x64/lib/ruby/2.7.0/win32api.rb:14: warning: already initialized constant Win32API::WIN32_TYPES
C:/Ruby27-x64/lib/ruby/2.7.0/Win32API.rb:14: warning: previous definition of WIN32_TYPES was here
C:/Ruby27-x64/lib/ruby/2.7.0/win32api.rb:15: warning: already initialized constant Win32API::DL_TYPES
C:/Ruby27-x64/lib/ruby/2.7.0/Win32API.rb:15: warning: previous definition of DL_TYPES was here
[17:44:19] $ "C:/Program Files/Unity_2020.1.3f1/Editor/Unity.exe" -projectPath C:/gitlab-runner/builds/o9ppoxYA/0/cloudcanards/CloudCanards -executeMethod CloudCanards.Core.Editor.Cli.CloudCanardsBuilder.Build -quit -batchmode --trace
[17:44:19] No pty implementation found. Falling back to popen. Output might be buffered
[17:44:20] Failure while trying to pipe C:/Windows/system32/config/systemprofile/AppData/Local/Unity/Editor/Editor.log: end of file reached
[17:44:20]   C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/file-tail-1.2.0/lib/file/tail.rb:185:in `readline'
[17:44:20]   C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/file-tail-1.2.0/lib/file/tail.rb:185:in `rescue in block in tail'
[17:44:20]   C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/file-tail-1.2.0/lib/file/tail.rb:179:in `block in tail'
[17:44:20]   C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/file-tail-1.2.0/lib/file/tail.rb:178:in `loop'
[17:44:20]   C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/file-tail-1.2.0/lib/file/tail.rb:178:in `tail'
[17:44:20]   C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/u3d-1.2.3/lib/u3d/unity_runner.rb:124:in `block in pipe'
[17:44:20]   C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/u3d-1.2.3/lib/u3d/unity_runner.rb:118:in `open'
[17:44:20]   C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/u3d-1.2.3/lib/u3d/unity_runner.rb:118:in `pipe'
[17:44:20]   C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/u3d-1.2.3/lib/u3d/unity_runner.rb:105:in `block in start_tail_thread'

Looking through the code, we thought this was an issue with race condition, and we added sleep(3) at line 118 of unity_runner. Here's the log that was printed afterwards:

$ C:/Ruby27-x64/bin/u3d.bat run -- -executeMethod CloudCanards.Core.Editor.Cli.CloudCanardsBuilder.Build -quit -batchmode --trace
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/u3d-1.2.3/lib/u3d/installation.rb:350: warning: Win32API is deprecated after Ruby 1.9.1; use fiddle directly instead
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/u3d-1.2.3/lib/u3d/installation.rb:409: warning: Win32API is deprecated after Ruby 1.9.1; use fiddle directly instead
C:/Ruby27-x64/lib/ruby/2.7.0/win32api.rb:10: warning: already initialized constant Win32API::DLL
C:/Ruby27-x64/lib/ruby/2.7.0/Win32API.rb:10: warning: previous definition of DLL was here
C:/Ruby27-x64/lib/ruby/2.7.0/win32api.rb:11: warning: already initialized constant Win32API::TYPEMAP
C:/Ruby27-x64/lib/ruby/2.7.0/Win32API.rb:11: warning: previous definition of TYPEMAP was here
C:/Ruby27-x64/lib/ruby/2.7.0/win32api.rb:12: warning: already initialized constant Win32API::POINTER_TYPE
C:/Ruby27-x64/lib/ruby/2.7.0/Win32API.rb:12: warning: previous definition of POINTER_TYPE was here
C:/Ruby27-x64/lib/ruby/2.7.0/win32api.rb:14: warning: already initialized constant Win32API::WIN32_TYPES
C:/Ruby27-x64/lib/ruby/2.7.0/Win32API.rb:14: warning: previous definition of WIN32_TYPES was here
C:/Ruby27-x64/lib/ruby/2.7.0/win32api.rb:15: warning: already initialized constant Win32API::DL_TYPES
C:/Ruby27-x64/lib/ruby/2.7.0/Win32API.rb:15: warning: previous definition of DL_TYPES was here
C:/Users/Administrator/AppData/Local/Unity/Editor/Editor.log
[22:36:13] $ "C:/Program Files/Unity_2020.1.3f1/Editor/Unity.exe" -projectPath C:/gitlab-runner/builds/o9ppoxYA/0/cloudcanards/CloudCanards -executeMethod CloudCanards.Core.Editor.Cli.CloudCanardsBuilder.Build -quit -batchmode --trace
[22:36:13] No pty implementation found. Falling back to popen. Output might be buffered

u3d was installed in a Windows Server 2019 with Ruby installed using Ruby Installer+msys2. The OS is running in a VM (with graphics) within an Ubuntu host. Although the logs were from GitLab, we also tried running u3d manually on cmd only to get the same result. We also checked to make sure that editor.log existed in the correct file path and was getting updated (by Unity) normally.

creativitRy avatar Oct 23 '20 06:10 creativitRy

I am having a similar issue where u3d is not printing the logs into the output in a Jenkins setup. Running on Windows 10. I used the ruby installer.

Command line looks like this: u3d run -- -quit -accept-apiupdate -batchmode -logFile Builds\\Logs\\GameName.log -projectPath \"GamePath\" -buildTarget Win64 -executeMethod BuildClass.BuildMethod

TWTristan avatar Jan 04 '24 16:01 TWTristan