AcademySoftwareFoundation / OpenCue

A render management system you can deploy for visual effects and animation productions.
https://www.opencue.io
Apache License 2.0
830 stars 201 forks source link

Percent sign (%) gets replaced by CWD in layer command #1181

Open ndeebook opened 2 years ago

ndeebook commented 2 years ago

Version: OpenCue 0.15.22

Hello,

So, here an example job log:

===========================================================
RenderQ JobSpec      Wed Aug  3 15:26:53 2022 

...
command              "ffmpeg.exe" -i ".../SEQ_11_FINAL_%06d.png" ... -y ".../SEQ_11_FINAL_5MBs.mp4"
...
cwd                  C:\Users\...\AppData\Local\Temp/crea-ffmpeg-..._ffmpeg_seq_11_final_10_mhzwf\0001-ffmpeg_encode_5mb
...
===========================================================

C:\Users\...\Desktop>"ffmpeg.exe" -i ".../SEQ_11_FINAL_C:\Users\...\AppData\Local\Temp\rqd\cmd-52d59035-c5ec-405c-b716-c6a0c35771e3-1659533213.4193966.bat6d.png" ... ".../SEQ_11_FINAL_5MBs.mp4" 
...

In the log summary (top) we can see that the command sent is not the same as the one actually run (below). The percent sign (%) is replaced by the current working directory.

The job was sent with Windows, using outline.cuerun.launch(outline.Outline(...)) The RQD host is also on Windows, installed with setup.py install Everything else runs just fine.

I tried adding and removing quotes around that command element but it did not have any effect.

ndeebook commented 2 years ago

Looking at rqd\rqd\rqcore.py, I see that FrameAttendantThread.runWindows uses _createCommandFile to save the command to a .bat file and then subprocess.Popen the .bat file. A direct call to the command would work while in a .bat file some characters must be escaped (which is the case of %).

Can't we get rid of the .bat file ? Otherwise characters escaping should be handled (this could help: https://www.robvanderwoude.com/escapechars.php & https://stackoverflow.com/questions/6828751/batch-character-escaping)

ndeebook commented 2 years ago

also, if an intermediate file is mandatory, why not consider a powershell script instead (which does not seem the need of escaping characters if we use quotes) ? subprocess.Popen(['powershell', 'path/to/command.ps1'])

Windows PowerShell comes installed by default in every Windows, starting with Windows 7 SP1 and Windows Server 2008 R2 SP1. (https://docs.microsoft.com/en-us/powershell/scripting/windows-powershell/install/installing-windows-powershell?view=powershell-7.2)