Closed Galbi3000 closed 5 years ago
Quick update, I did run the following command from the related docker git project you point to: docker pull jmaxwilson/povray That worked with no errors but the extension still gives the same error as shown in OP.
I know what is going wrong. It does not like spaces in the paths!
If I manually run the command:
docker run -v d:\Documents\My Projects\VS Code\Povray Scenes\Pencil\:/source -v d:\Documents\My Projects\VS Code\Povray Scenes\Pencil:/output jmaxwilson/povray Pencil.pov Width=1920 Height=1080 Output_File_Type=J
I get the following error:
docker: invalid reference format: repository name must be lowercase.
See 'docker run --help'.
But if I wrap the two -v arguments with double quotation marks like this:
docker run -v "d:\Documents\My Projects\VS Code\Povray Scenes\Pencil\:/source" -v "d:\Documents\My Projects\VS Code\Povray Scenes\Pencil:/output" jmaxwilson/povray Pencil.pov Width=1920 Height=1080 Output_File_Type=J
It works fine. The extension needs to use quotes in case of spaces in paths.
I edited my local version of extension.js in the out folder for the extension in Visual Studio Code and changed the code for adding the paths to include quotes:
exe += " run -v \"" + dockerSource + ":/source\" -v \"" + dockerOutput + ":/output\" " + settings.useDockerImage;
But I still get the error!
> Executing task: docker run -v "d:\Documents\My Projects\VS Code\Povray Scenes\Pencil\:/source" -v "d:\Documents\My Projects\VS Code\Povray Scenes\Pencil:/output" jmaxwilson/povray Pencil.pov Width=1920 Height=1080 Output_File_Type=J <
C:\Program Files\Docker\Docker\Resources\bin\docker.exe: invalid reference format: repository name must be lowercase.
See 'C:\Program Files\Docker\Docker\Resources\bin\docker.exe run --help'.
The terminal process terminated with exit code: 1
This version of the command works from the command line but not from within the extension!
Output of command line when run manually:
docker run -v "d:\Documents\My Projects\VS Code\Povray Scenes\Pencil\:/source" -v "d:\Documents\My Projects\VS Code\Povray Scenes\Pencil:/output" jmaxwilson/povray Pencil.pov Width=1920 Height=1080 Output_File_Type=J
Persistence of Vision(tm) Ray Tracer Version 3.7.0.8.unofficial (g++ 8.3.0 @
x86_64-pc-linux-musl)
This is an unofficial version compiled by:
Docker
jmaxwilson/povray:3.7-stable
https://cloud.docker.com/repository/docker/jmaxwilson/povray
The POV-Ray Team is not responsible for supporting this version.
POV-Ray is based on DKBTrace 2.12 by David K. Buck & Aaron A. Collins
Copyright 1991-2013 Persistence of Vision Raytracer Pty. Ltd.
Primary POV-Ray 3.7 Architects/Developers: (Alphabetically)
Chris Cason Thorsten Froehlich Christoph Lipka
With Assistance From: (Alphabetically)
Nicolas Calimet Jerome Grimbert James Holsenback Christoph Hormann
Nathan Kopp Juha Nieminen
Past Contributors: (Alphabetically)
Steve Anger Eric Barish Dieter Bayer David K. Buck
Nicolas Calimet Chris Cason Aaron A. Collins Chris Dailey
Steve Demlow Andreas Dilger Alexander Enzmann Dan Farmer
Thorsten Froehlich Mark Gordon James Holsenback Christoph Hormann
Mike Hough Chris Huff Kari Kivisalo Nathan Kopp
Lutz Kretzschmar Christoph Lipka Jochen Lippert Pascal Massimino
Jim McElhiney Douglas Muir Juha Nieminen Ron Parker
Bill Pulver Eduard Schwan Wlodzimierz Skiba Robert Skinner
Yvo Smellenbergh Zsolt Szalavari Scott Taylor Massimo Valentini
Timothy Wegner Drew Wells Chris Young
Other contributors are listed in the documentation.
Support libraries used by POV-Ray:
ZLib 1.2.11, Copyright 1995-2012 Jean-loup Gailly and Mark Adler
LibPNG 1.6.35, Copyright 1998-2012 Glenn Randers-Pehrson
LibJPEG 80, Copyright 1991-2013 Thomas G. Lane, Guido Vollbeding
LibTIFF 4.0.10, Copyright 1988-1997 Sam Leffler, 1991-1997 SGI
Boost 1.67, http://www.boost.org/
OpenEXR 2.2.1 and IlmBase 2.2.0, Copyright (c) 2002-2011 Industrial Light &
Magic.
Parser Options
Input file: Pencil.pov
Remove bounds........On
Split unions.........Off
Library paths:
/usr/local/share/povray-3.7
/usr/local/share/povray-3.7/ini
/usr/local/share/povray-3.7/include
Clock value: 0.000 (Animation off)
Image Output Options
Image resolution.....1920 by 1080 (rows 1 to 1080, columns 1 to 1920).
Output file..........Pencil.jpg, 24 bpp, quality 85% JPEG
Graphic display......On (gamma: sRGB)
Mosaic preview.......Off
Continued trace......Off
Information Output Options
All Streams to console..........On
Debug Stream to console.........On
Fatal Stream to console.........On
Render Stream to console........On
Statistics Stream to console....On
Warning Stream to console.......On
==== [Parsing...] ==========================================================
Couldn't initialize SDL: No available video device.
----------------------------------------------------------------------------
Parser Statistics
----------------------------------------------------------------------------
Finite Objects: 5
Infinite Objects: 1
Light Sources: 1
Total: 7
----------------------------------------------------------------------------
Parser Time
Parse Time: 0 hours 0 minutes 0 seconds (0.016 seconds)
using 1 thread(s) with 0.005 CPU-seconds total
Bounding Time: 0 hours 0 minutes 0 seconds (0.000 seconds)
using 1 thread(s) with 0.000 CPU-seconds total
----------------------------------------------------------------------------
Render Options
Quality: 9
Bounding boxes.......On Bounding threshold: 3
Antialiasing.........Off
==== [Rendering...] ========================================================
Rendered 2073600 of 2073600 pixels (100%)
----------------------------------------------------------------------------
Render Statistics
Image Resolution 1920 x 1080
----------------------------------------------------------------------------
Pixels: 2073600 Samples: 0 Smpls/Pxl: 0.00
Rays: 2237041 Saved: 0 Max Level: 2/5
----------------------------------------------------------------------------
Ray->Shape Intersection Tests Succeeded Percentage
----------------------------------------------------------------------------
Box 15322097 6407650 41.82
Cone/Cylinder 7079639 742998 10.49
CSG Intersection 9893323 1497352 15.13
CSG Merge 10778557 3276373 30.40
Plane 4160725 2112042 50.76
Sphere 4464549 1667 0.04
True Type Font 3698918 0 0.00
Bounding Box 20803625 4108101 19.75
----------------------------------------------------------------------------
Shadow Ray Tests: 2075241 Succeeded: 151601
Shadow Cache Hits: 151557
Reflected Rays: 163441
----------------------------------------------------------------------------
----------------------------------------------------------------------------
Render Time:
Photon Time: No photons
Radiosity Time: No radiosity
Trace Time: 0 hours 0 minutes 0 seconds (0.959 seconds)
using 6 thread(s) with 5.075 CPU-seconds total
POV-Ray finished
As you see, it works when run manually using the quotes.
I'll leave it with you now.
@Galbi3000 Thanks for reporting this bug. In all of my testing, I did not test any use cases for spaces in the paths. I have been able to reproduce the bug and I have a a branch that will fix the issue mounting docker paths that include spaces. (When the command it run through the VS Code integrated shell, for some reason, if the shell is Powershell it doesn't work unless the path volume parameters are surrounded by single quotes, not double quotes. But if the shell is cmd.exe, it doesn't work with single quotes, it has to be double quotes).
So I modified the buildShellPOVExe() function with the following:
// mount the source and output directories
if (context.isWindowsPowershell) {
// If the shell is Powershell, use single quotes around paths to make sure spaces in paths work correctly
exe += " run -v \'"+dockerSource+":/source\' -v \'"+dockerOutput+":/output\' "+settings.useDockerImage;
} else {
// otherwise use double quotes around paths to make sure that spaces work correctly
exe += " run -v \""+dockerSource+":/source\" -v \""+dockerOutput+":/output\" "+settings.useDockerImage;
}
That change works for me when I test on Powershell, cmd.exe, and WSL Bash.
Because of this docker bug report, I have uncovered a related bug with the setting that lets you specify an output path. If the resulting output path includes spaces, POv-Ray fails to parse the path properly, even if it is surrounded by quotes. So far I have not been able to find a fix for that related issue.
I will probably release an update that fixes the issue for docker, and then explore ways to fix the issue with custom output paths that contain spaces as a separate bug.
The fix works, though I had to manually install it from the Git, I kept the Git location separate so VS Code can still revert to the original when it's updated.
So, looking at the terminal output and your code it is using PowerShell to run the command. I was using TakeCommand (A 100% CMD.EXE compatible alternative). Trust Microsoft to change a basic command line function! Though they could do what BASH does, support both single and double quotes! I suppose TakeCommand could do the same also, but they are being 100% backwards compatible with CMD :D
Ahh, I just ran into another related problem. The Docker error occurs again if the .pov file also contains spaces. Easy enough for me to fix given your previous fix.
Ok, this one is a little more complicated. This time it's not Docker, it's the implementation of povray you are using within the virtual machine! This is also made more complicated by the way both CMD and PowerShell work with quotes!
The file I used is called "Earth Globe.pov" so the command output was as follows (using PowerShell):
> Executing task: docker run -v 'd:\Documents\My Projects\VS Code\Povray Scenes\Earth\:/source' -v 'd:\Documents\My Projects\VS Code\Povray Scenes\Earth:/output' jmaxwilson/povray Earth Globe.pov Width=1920 Height=1080 Output_File_Type=J <
Problem with option setting
povray Earth Globe.pov Width=1920 Height=1080 Output_File_Type=J
Failed to parse command-line option
The terminal process terminated with exit code: 1
I found with experimentation that the povray command in your Docker virtual machine requires single quotes around the file name if it contains spaces. So I got it to use this command:
docker run -v 'd:\Documents\My Projects\VS Code\Povray Scenes\Earth\:/source' -v 'd:\Documents\My Projects\VS Code\Povray Scenes\Earth:/output' jmaxwilson/povray 'Earth Globe.pov' Width=1920 Height=1080 Output_File_Type=J
But it came up with the same error! The problem this time is that Docker is not passing the single quotes to the virtual machine as seen in the error message. So the problem became: How to force the single quotes through?
This is achieved with the following PowerShell command:
docker run -v 'd:\Documents\My Projects\VS Code\Povray Scenes\Earth\:/source' -v 'd:\Documents\My Projects\VS Code\Povray Scenes\Earth:/output' jmaxwilson/povray '''
Earth Globe.pov''' Width=1920 Height=1080 Output_File_Type=J
Yep, you have to use 3 single quotes to include a single one in the quoted area, this may also solve your other issue! So that's PowerShell fixed.
I found that using CMD I had to change the command to:
docker run -v "d:\Documents\My Projects\VS Code\Povray Scenes\Earth\:/source" -v "d:\Documents\My Projects\VS Code\Povray Scenes\Earth:/output" jmaxwilson/povray "'Earth Globe.pov'" Width=1920 Height=1080 Output_File_Type=J
The code I changed my end:
export function buildRenderOptions(settings: any, fileInfo: any, outFilePath: string, context: ShellContext) {
// Start building the render command that will be run in the shell
let renderOptions = "";
if (context.isWindowsPowershell) {
// If the shell is Powershell, use 3 single quotes around filenames to make sure spaces in paths work correctly
renderOptions += " '''${fileBasename}'''";
} else {
// otherwise use double and single quotes around filenames to make sure that spaces work correctly
renderOptions += " \"'${fileBasename}'\"";
}
renderOptions += getDisplayRenderOption(settings);
renderOptions += getDimensionOptions(settings, fileInfo);
renderOptions += getOutputPathOption(settings, outFilePath, context);
renderOptions += getLibraryPathOption(settings, context);
renderOptions += getOutputFormatOption(settings);
renderOptions += getCustomCommandlineOptions(settings);
// If the integrated terminal is Powershell running on Windows, we need to pipe the pvengine.exe through Out-Null
// to make powershell wait for the rendering to complete and POv-Ray to close before continuing
if (context.isWindowsPowershell && !settings.useDockerToRunPovray) {
renderOptions += " | Out-Null";
}
return renderOptions;
}
P.S. You do not need to escape single quotes with \' in strings with JScript, just use the quotes as normal characters :)
Your new fix today to the .pov filename having spaces does not work:
> Executing task: docker run -v 'd:\Documents\My Projects\VS Code\Povray Scenes\Earth\:/source' -v 'd:\Documents\My Projects\VS Code\Povray Scenes\Earth:/output' jmaxwilson/povray "'"Earth\ Globe.pov"'" Width=1920 Height=1080 Output_File_Type=J <
C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: error while creating mount source path '/host_mnt/d/Documents/My Projects/VS Code/Povray Scenes/Earth': mkdir /host_mnt/d: file exists.
The terminal process terminated with exit code: 1
Changes I made to buildRenderOptions() in my local extension.js from the out folder of the extension:
// Handle the edge cases where the input file name contains spaces
if (fileInfo.fileName.indexOf(" ") !== -1) {
if (context.platform !== "win32" || settings.useDockerToRunPovray) {
if (context.isWindowsPowershell) {
// For Docker on Windows using PowerShell we have to put tripple single quotes around
// the filename if it has spaces in it
renderOptions = " '''${fileBasename}'''";
}
else {
// For Mac, Linux, and Docker (not on Windows) we have to put some weird quoting around
// the filename if it has spaces in it
// "'"File\ Name.pov"'""
renderOptions = ' "\'"' + fileInfo.fileName.replace(/ /g, "\\ ") + '"\'"';
}
}
}
Thanks for all of your help @Galbi3000 . I've pushed up some additional changes to the branch based upon your work. On the branch I think I have spaces in paths and filenames handled on Mac, Linux, and Windows with and without Docker for almost all scenarios. It works on Windows & Docker using WSL Bash, Powershell, and cmd.exe as the shell. And it works on Windows without Docker using WSL Bash and cmd.exe as the shell.
The one scenario that isn't working is Powershell without Docker. :/ I can get it to work when I run it through Powershell manually, but when it runs through VS Code in Powershell as the integrated terminal, it fails when there is a space in the output path.
I'll keep poking at it and see if I can find a solution.
I'll see what I can come up with for PowerShell without Docker :) At first glance I can see no quotes round the file name:
> Executing task: pvengine /EXIT /RENDER Earth Globe.pov Width=1920 Height=1080 Output_File_Type=J | Out-Null <
I think this problem is because of how JScript is (mis)handling quotes. In this case a single quote inside 2 double quotes is not being parsed correctly. You currently have (line 391 in extension.ts):
fileInputOption = "'"+fileInfo.fileName+"'";
For some reason JS is ignoring the single quote! So in this case you do have to escape them:
fileInputOption = "\'"+fileInfo.fileName+"\'";
Then it works correctly.
Alternatively:
fileInputOption = "'${fileBasename}'";
Also works without having to escape the single quotes!
Interesting. It seems that I am not seeing the same behavior as you are. As I continue to test, for me line 391 works as it is, without escaping the single quotes. I wonder why your installation requires the single quotes to be escaped?
Here is my Powershell version:
PS C:\> $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
5 1 17134 590
And here is my VS Code version:
Version: 1.33.1 (system setup)
Commit: 51b0b28134d51361cf996d2f0a1c698247aeabd8
Date: 2019-04-11T08:27:14.102Z
Electron: 3.1.6
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Windows_NT x64 10.0.17134
So Powershell works for me when the input file name has a space. But not if I use the settings to customize the output path to "./output". On my setup it chokes on the space in the output path.
Yeah, I am not specifying a custom output path. I'll try that next.
My PowerShell is the same as yours:
PS C:\Users\galbi> $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
5 1 17134 590
And VSCode is the same too:
Version: 1.33.1 (system setup)
Commit: 51b0b28134d51361cf996d2f0a1c698247aeabd8
Date: 2019-04-11T08:27:14.102Z
Electron: 3.1.6
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Windows_NT x64 10.0.17134
Very strange :/
This is puzzling!
My findings so far regarding the custom output path are odd!
First, I have found that my version of POV-Ray will accept the full normalised path to the output file when ran from CMD BUT it complains it does not have IO access to it!
Preset INI file is 'D:\Documents\POV-Ray\v3.7\ini\quickres.ini', section is '[1920x1080 16:9 AA 0.3]'.
Preset source file is 'Earth Globe.pov'.
Rendering using command line 'Width=1920 Height=1080 Output_File_Name="d:\Documents\My Projects\VS Code\Povray Scenes\Earth\Output Images\Earth Globe.jpg" Output_File_Type=J'.
Persistence of Vision(tm) Ray Tracer Version 3.7.0.msvc10
This is an official version prepared by the POV-Ray Team. See the
documentation on how to contact the authors or visit us on the
internet at http://www.povray.org/
POV-Ray is based on DKBTrace 2.12 by David K. Buck & Aaron A. Collins
Copyright 1991-2013 Persistence of Vision Raytracer Pty. Ltd.
Primary POV-Ray 3.7 Architects/Developers: (Alphabetically)
Chris Cason Thorsten Froehlich Christoph Lipka
With Assistance From: (Alphabetically)
Nicolas Calimet Jerome Grimbert James Holsenback Christoph Hormann
Nathan Kopp Juha Nieminen
Past Contributors: (Alphabetically)
Steve Anger Eric Barish Dieter Bayer David K. Buck
Nicolas Calimet Chris Cason Aaron A. Collins Chris Dailey
Steve Demlow Andreas Dilger Alexander Enzmann Dan Farmer
Thorsten Froehlich Mark Gordon James Holsenback Christoph Hormann
Mike Hough Chris Huff Kari Kivisalo Nathan Kopp
Lutz Kretzschmar Christoph Lipka Jochen Lippert Pascal Massimino
Jim McElhiney Douglas Muir Juha Nieminen Ron Parker
Bill Pulver Eduard Schwan Wlodzimierz Skiba Robert Skinner
Yvo Smellenbergh Zsolt Szalavari Scott Taylor Massimo Valentini
Timothy Wegner Drew Wells Chris Young
Other contributors are listed in the documentation.
Support libraries used by POV-Ray:
ZLib 1.2.7, Copyright 1995-2012 Jean-loup Gailly and Mark Adler
LibPNG 1.5.14, Copyright 1998-2012 Glenn Randers-Pehrson
LibJPEG 9, Copyright 1991-2013 Thomas G. Lane, Guido Vollbeding
LibTIFF 3.8.2, Copyright 1988-1997 Sam Leffler, 1991-1997 SGI
Boost 1.45, http://www.boost.org/
OpenEXR, Copyright (c) 2004-2007, Industrial Light & Magic.
-
IO Restrictions prohibit write access to 'd:\Documents\My Projects\VS Code\Povray Scenes\Earth\Output Images\Earth Globe.jpg'
Failed to start render: Cannot open file.
I get the same result running it manually from a command prompt ran as administrator! But it gets stranger, if I manually run the same command again but use relative paths:
pvengine /EXIT /RENDER "Earth Globe.pov" Width=1920 Height=1080 Output_File_Name=".\Output Images\Earth Globe.jpg" Output_File_Type=J
it works with no file IO restrictions!
All that said though, the POV-Ray manual states that the Output_File_Name should be either set to an alternative file name for the image or a path to a new location to store the image, which will be the same name as if you did specify Output_File_Name just in the new location. If does not say you can combine the 2 but that does seem to work...
... except when I run it from PowerShell! For some reason when it's run from PowerShell POV-Ray thinks the Output_File_Name=... argument as a whole is a full path to an ini file to be included in the render!
If I type this command to PowerShell:
pvengine /EXIT /RENDER 'Earth Globe.pov' Width=1920 Height=1080 Output_File_Name='d:\Documents\My Projects\VS Code\Povray Scenes\Earth\Output Images\Earth Globe.jpg' Output
_File_Type=J
I get the following POV-Ray output in the messages tab:
Preset INI file is 'D:\DOCUMENTS\POV-RAY\V3.7\INI\QUICKRES.INI', section is '[1920x1080 16:9 AA 0.3]'.
Preset source file is 'Earth Globe.pov'.
Rendering using command line 'Width=1920 Height=1080 "Output_File_Name=d:\Documents\My Projects\VS Code\Povray Scenes\Earth\Output
Images\Earth Globe.jpg" Output_File_Type=J'.
Persistence of Vision(tm) Ray Tracer Version 3.7.0.msvc10
This is an official version prepared by the POV-Ray Team. See the
documentation on how to contact the authors or visit us on the
internet at http://www.povray.org/
POV-Ray is based on DKBTrace 2.12 by David K. Buck & Aaron A. Collins
Copyright 1991-2013 Persistence of Vision Raytracer Pty. Ltd.
Primary POV-Ray 3.7 Architects/Developers: (Alphabetically)
Chris Cason Thorsten Froehlich Christoph Lipka
With Assistance From: (Alphabetically)
Nicolas Calimet Jerome Grimbert James Holsenback Christoph Hormann
Nathan Kopp Juha Nieminen
Past Contributors: (Alphabetically)
Steve Anger Eric Barish Dieter Bayer David K. Buck
Nicolas Calimet Chris Cason Aaron A. Collins Chris Dailey
Steve Demlow Andreas Dilger Alexander Enzmann Dan Farmer
Thorsten Froehlich Mark Gordon James Holsenback Christoph Hormann
Mike Hough Chris Huff Kari Kivisalo Nathan Kopp
Lutz Kretzschmar Christoph Lipka Jochen Lippert Pascal Massimino
Jim McElhiney Douglas Muir Juha Nieminen Ron Parker
Bill Pulver Eduard Schwan Wlodzimierz Skiba Robert Skinner
Yvo Smellenbergh Zsolt Szalavari Scott Taylor Massimo Valentini
Timothy Wegner Drew Wells Chris Young
Other contributors are listed in the documentation.
Support libraries used by POV-Ray:
ZLib 1.2.7, Copyright 1995-2012 Jean-loup Gailly and Mark Adler
LibPNG 1.5.14, Copyright 1998-2012 Glenn Randers-Pehrson
From line 3 of that output it appears that PowerShell is adding double quotation marks around the whole Output_File_Name argument and removing the singles instead of passing the argument to POV-Ray as written! It's also doing it when run from VSCode.
Very strange behaviour! Perhaps something is going wrong on my system? It all seems to work just fine if I use Docker though so I will switch that back on. This one is doing my head in, thanks Microsoft! :D
I think PowerShell is detecting the spaces in the output path and automatically surrounding the whole argument in double quotes. I've been experimenting on different ways to pass arguments to POV-Ray with no success. It seems it's done after parsing the command line and before actually executing the command. Sort of like a 2 parsing pass that we have no control over!
I'll keep looking in to it tomorrow :)
I've committed some additional changes to the branch. They don't eliminate the Powershell problem completely, but they do mitigate it substantially.
I refactored the way that the output path option works so that instead of using the full path and filename which is calculated for the purpose of opening the file after rendering has completed, it uses the settings.outputPath
directly.
That way, the filename is not included in the output path, so even if the file name has spaces it doesn't trigger the escaping problem in Powershell. It also means that even if the input file is located in a path with a space in the name, if the settings.outputPath
is relative (./output
) it will still work properly even though there is a space in the full path.
So the scenario that still fails is: Powershell with a space in the path literally defined in settings.outputPath
.
If the filename is scene file.pov
and it is located in C:\pov\my scenes\scene
and the settings.outputPath
is set to ./output
, the extension will generate the following call to run POV-Ray:
pvengine /EXIT /RENDER 'scene file.pov' -D Width=1024 Height=768 Output_File_Name=./output/ | Out-Null
Which will work fine because the output path is relative and doesn't include the filename.
But if the settings.outputPath
is set to ./out put
or to C:\pov\my scenes\output
the extension generates the call like this:
pvengine /EXIT /RENDER 'scene file.pov' -D Width=1024 Height=768 Output_File_Name='./out put/' | Out-Null
pvengine /EXIT /RENDER 'scene file.pov' -D Width=1024 Height=768 Output_File_Name='C:\pov\my scenes\output\' | Out-Null
In these cases the file still renders, but because Powershell+POV-Ray doesn't parse the output path correctly POV-Ray can't find the path and the file is rendered into the source folder instead and fails to open when rendering completes.
So the bug is still there, but has been relegated to a smaller edge case.
I need to do some more testing on the other scenarios, and then I will try to release the update this weekend. I'll list this Powershell edge case as a known issue.
From my research the bug is in PowerShell.
I have gone as far as manually entering the command line using different methods ranging from grouped quotation marks to using variables and all give the same result for that one argument to POV-Ray. If the path contains spaces PowerShell will always re-parse the argument and automatically encase the whole argument in double quotes.
So, Output_File_Name='./out put/'
will be changed to "Output_File_Name=/out put/"
, notice it also removes the single quotation marks.
I believe there should be a way to prevent this happening but I do not have enough knowledge of PowerShell to find out what it is. If there is not a way then Microsoft have made a grave error of assumption when it comes to arguments to external commands.
Thanks for your investigation and help! Very much appreciated.
Yesterday I downloaded and installed Powershell 6.2 https://github.com/PowerShell/PowerShell/releases to see if perhaps the newer version would work. Nope. Same problem.
Yep, I did the same thing :)
Also, something else to consider, if in VSCode you change the settings to use an external command line processor (E.G. I could set it up to use TCC) then your extension assumes it to be bash and sets the command up accordingly which makes the command fail if the external command processor is CMD compatible (like TCC is). Not sure how you would go about dealing with that so I would just include a disclaimer that setting an external command processor in VSCode may break the functionality of the extension :)
As a thought, it could be possible to suggest a change to the POV-Ray team so that they can parse arguments that may be fully enclosed in quotation marks by command processors like PowerShell. Though given the infrequency of their updates that may not be as good an idea as it sounds lol
...if in VSCode you change the settings to use an external command line processor (E.G. I could set it up to use TCC) then your extension assumes it to be bash and sets the command up accordingly which makes the command fail if the external command processor is CMD compatible (like TCC is).
I installed TCC to see if I can reproduce the error you are seeing. I updated the VS Code settings to set terminal.integrated.shell.windows
setting to C:\Program Files\JPSoft\TCC24\tcc.exe
and on the branch for this bug, it seems to work. It treats it the same as if it were cmd.exe
.
Can you give me some additional details about your configuration?
You are changing the internal shell, I said the external one. Scroll up to the top of that section of the settings, you will see a check box to tell it to use an external shell and below that a box to enter the full path/filename to the shell. Set those and try again :)
@Galbi3000 I merged the branch with the fixes Friday night. If you can confirm that the extension now works for you with docker when there are spaces in the path or filename, I'll go ahead and mark this as fixed.
We can put in a separate issue for the external terminal bug.
Looks good :)
Thanks again for all of you help!
You are welcome :)
Hi, I am using version 1.33.1 of Visual Studio Code and added the Pov-Ray extension a few days ago. I like the extension but do not like the way the POV-Ray editor opens whenever you click to render the image. I know that is not an issue with the extension but rather how POV-Ray 3.7 works from the command line. So I noticed the "Use Docker to run POV-Ray" option and decided to try that. I installed Docker, signed up to create an account with Docker and thought all would be good. Nope, after I enabled the "Use Docker to run POV-Ray" option in the settings and clicked to render a working .pov file I get the following in the terminal:
Clearly the option to use Docker does not work 'out of the box' but there are no detailed instructions on how to use the extension with Docker.