1. system_exec()
- Posted by andi49 Jul 02, 2013
- 1769 views
Hi system_exec() can't handle pathnames including spaces. On Windows this is a real problem.
My Question: Is this by design or is this a Windows problem?
Andreas
2. Re: system_exec()
- Posted by BRyan Jul 02, 2013
- 1745 views
Hi system_exec() can't handle pathnames including spaces. On Windows this is a real problem.
My Question: Is this by design or is this a Windows problem?
Andreas
Windows requires that path names with spaces have to be enclose in quotes .
3. Re: system_exec()
- Posted by andi49 Jul 02, 2013
- 1836 views
HI
Windows requires that path names with spaces have to be enclose in quotes .
Even quoting does not work with system_exec(), i have to pass every path through Getshortfilename(), this broke the setup for
for my modified Designer on WInXP.
As it uses %HOMEPATH% as the basediretory for created Projects.
On Win 6.0 and bigger this is okay (%HOMEPATH%=Drive:\users\username)}
But on XP this is 'Drive:\Documents and Settings\username'
Andreas
4. Re: system_exec()
- Posted by BRyan Jul 02, 2013
- 1754 views
HI
Windows requires that path names with spaces have to be enclose in quotes .
Even quoting does not work with system_exec(), i have to pass every path through Getshortfilename(), this broke the setup for
for my modified Designer on WInXP.
As it uses %HOMEPATH% as the basediretory for created Projects.
On Win 6.0 and bigger this is okay (%HOMEPATH%=Drive:\users\username)}
But on XP this is 'Drive:\Documents and Settings\username'
Andreas
When you use system_exec because you are using a sequence you have to escape the quotes
" \"Drive:\\Documents and Settings\\username\" "
5. Re: system_exec()
- Posted by andi49 Jul 04, 2013
- 1730 views
Windows requires that path names with spaces have to be enclose in quotes .
When you use system_exec because you are using a sequence you have to escape the quotes
" \"Drive:\\Documents and Settings\\username\" "
Hi
From the manual...
[...] On WINDOWS, system_exec() does not allow the use of command-line redirection in command. Nor does it allow you to quote strings that contain blanks, such as file names. [...]
Andreas
7. Re: system_exec()
- Posted by jimcbrown (admin) Jul 04, 2013
- 1699 views
Windows requires that path names with spaces have to be enclose in quotes .
When you use system_exec because you are using a sequence you have to escape the quotes
" \"Drive:\\Documents and Settings\\username\" "
Hi
From the manual...
[...] On WINDOWS, system_exec() does not allow the use of command-line redirection in command. Nor does it allow you to quote strings that contain blanks, such as file names. [...]
Andreas
Hmm, this is curious. Have you tested it? Looking at the code that implements system_exec on windoze, it seems that there is actually rudimentary support for using double quotes and even escaping double quotes.
That comment may have been misplaced and intended for pipeio:exec(), where this windoze-only restriction still holds true.
If it doesn't work, then - based on the clear intention of the code - I'd say that Euphoria would have a bug that needs to be fixed. It's definitely not a design feature for quotes and spacing to be unsupported.
8. Re: system_exec()
- Posted by andi49 Jul 04, 2013
- 1676 views
Did you try it ?
Yes, i tried it ...
The problem is not, to work around it. The problem is, i do not know where this case appears.
So at the end, i have to pass everything through GetShortFilename() to just get sure it works...
Not very satisfying to put everything back to the old 8.3 Filenames...
Maybe it is an Windows issue, i just don't know.
(BTW: MCI_SendString() has the same problem)
Andreas
9. Re: system_exec()
- Posted by BRyan Jul 04, 2013
- 1729 views
Did you try it ?
Yes, i tried it ...
The problem is not, to work around it. The problem is, i do not know where this case appears.
So at the end, i have to pass everything through GetShortFilename() to just get sure it works...
Not very satisfying to put everything back to the old 8.3 Filenames...
Maybe it is an Windows issue, i just don't know.
(BTW: MCI_SendString() has the same problem)
Andreas
Andreas Why don't you just post an example of what you are trying to do and I am sure someone can help you. It is allot easier if we can see your code.
}}}
10. Re: system_exec()
- Posted by andi49 Jul 04, 2013
- 1714 views
include std/console.e sequence string string = "\"C:\\Program Files (x86)\\EuDesigner\\edit.exe\"" system_exec(string) -- This works puts(1,string&"\n") any_key() string="\"C:\\Program Files (x86)\\EuDesigner\\edit.exe C:\\Program Files (x86)\\EuDesigner\\license.txt\"" system_exec(string) -- This not puts(1,string&"\n") any_key() string="\"C:\\Program Files (x86)\\EuDesigner\\edit.exe\""&" "&"\"C:\\Program Files (x86)\\EuDesigner\\license.txt\"" -- This not. Just Starts the Editor system_exec(string) puts(1,string&"\n") any_key()
11. Re: system_exec()
- Posted by BRyan Jul 04, 2013
- 1693 views
-- Name this file test.exw and run it with euiw.exe This code tested -- Examine your quotes and compare to these. include std/console.e sequence string string = " \"C:\\Program Files (x86)\\EuDesigner\\edit.exe\" " system_exec(string) -- This works puts(1,string&"\n") any_key()
12. Re: system_exec()
- Posted by jimcbrown (admin) Jul 04, 2013
- 1683 views
string = "\"C:\\Program Files (x86)\\EuDesigner\\edit.exe\"" system_exec(string) -- This works puts(1,string&"\n") any_key()
It should.
string="\"C:\\Program Files (x86)\\EuDesigner\\edit.exe C:\\Program Files (x86)\\EuDesigner\\license.txt\"" system_exec(string) -- This not puts(1,string&"\n") any_key()
It shouldn't. That makes it look like you have a big txt file called "C:\Program Files (x86)\EuDesigner\edit.exe C:\Program Files (x86)\EuDesigner\license.txt" that you want to run.
string="\"C:\\Program Files (x86)\\EuDesigner\\edit.exe\""&" "&"\"C:\\Program Files (x86)\\EuDesigner\\license.txt\"" -- This not. Just Starts the Editor system_exec(string) puts(1,string&"\n") any_key()
This should have worked. I'm not sure why it failed. Does something like this work?
string="\"C:\\Windows\\System32\\notepad.exe\""&" "&"\"C:\\Program Files (x86)\\EuDesigner\\license.txt\"" system_exec(string) puts(1,string&"\n") any_key()
I wonder if spawnvp() simply can't deal with spaces in its arguments but requires them to be quoted. (IMNSHO it shouldn't, but this is windoze after all.) So that suggests another thing to try is this:
string="\"C:\\Windows\\System32\\notepad.exe\""&" "&"\"\\\"C:\\Program Files (x86)\\EuDesigner\\license.txt\\\"\"" system_exec(string) puts(1,string&"\n") any_key()
13. Re: system_exec()
- Posted by andi49 Jul 04, 2013
- 1718 views
-- Name this file test.exw and run it with euiw.exe This code tested -- Examine your quotes and compare to these. include std/console.e sequence string string = " \"C:\\Program Files (x86)\\EuDesigner\\edit.exe\" " system_exec(string) -- This works puts(1,string&"\n") any_key()
?
This allready works...
Again... with working code included...
include tinewg.exw include std/console.e sequence string,string1 string = "\"C:\\Program Files (x86)\\EuDesigner\\edit.exe\"" system_exec(string) -- This works puts(1,string&"\n") any_key() string="\"C:\\Program Files (x86)\\EuDesigner\\edit.exe C:\\Program Files (x86)\\EuDesigner\\license.txt\"" system_exec(string) -- This not puts(1,string&"\n") any_key() string="\"C:\\Program Files (x86)\\EuDesigner\\edit.exe\""&" "&"\"C:\\Program Files (x86)\\EuDesigner\\license.txt\"" -- This not. Just Starts the Editor system_exec(string) puts(1,string&"\n") any_key() string1=ShortFileName("C:\\Program Files (x86)\\EuDesigner\\edit.exe") string=ShortFileName("C:\\Program Files (x86)\\EuDesigner\\license.txt") system_exec(string1&" "&string) -- This does what it should do!!!! Starting the Editor with the file loaded puts(1,string1&" "&string) any_key()
ShortFilename() just creates an 8.3 Filename using GetShortFileNmae() from the Win32Api
Any help is really welcome
Maybe i just misunderstood how to use system_exec()
Andreas
14. Re: system_exec()
- Posted by gbonvehi Jul 05, 2013
- 1743 views
Andreas, I thought it should work that way too so I did some tests and found a problem when Eu4 parses the arguments to be sent to spawnvp method. It basically removes the quotes around the parameters before sending them.
I did a patch to correct this, it's on http://openeuphoria.org/pastey/223.wc , you'll have to recompile the interpreter (I can provide you stripped binaries if you need to). I'm not very good at C so I cannot guarantee the code is 100% correct, if someone wants to review it I'll be glad to fix it.
Cheers,
Guillermo Bonvehi
PS: The patch was created using Euphoria 4.0.5 source.
Forked into: gbonvehi as dev?
15. Re: system_exec()
- Posted by andi49 Jul 05, 2013
- 1648 views
[...] I wonder if spawnvp() simply can't deal with spaces in its arguments but requires them to be quoted. (IMNSHO it shouldn't, but this is windoze after all.) So that suggests another thing to try is this:
string="\"C:\\Windows\\System32\\notepad.exe\""&" "&"\"\\\"C:\\Program Files (x86)\\EuDesigner\\license.txt\\\"\"" system_exec(string) puts(1,string&"\n") any_key()
This works.
Maybe gbonvehi found a solution. http://openeuphoria.org/pastey/223.wc
Andreas