Issue 18496 - StarBasic command "shell" problem
Summary: StarBasic command "shell" problem
Status: ACCEPTED
Alias: None
Product: udk
Classification: Code
Component: code (show other issues)
Version: OOo 1.0.3
Hardware: PC Windows 2000
: P3 Trivial (vote)
Target Milestone: AOO PleaseHelp
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
: 35568 (view as issue list)
Depends on:
Blocks:
 
Reported: 2003-08-21 16:13 UTC by tb
Modified: 2017-05-20 11:29 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description tb 2003-08-21 16:13:33 UTC
I have to execute an external programm with some parameters:

> hallo.exe -c "xyz abc?status=test&ort=platte c"

The command processor gets this as two parameters an anything is ok. In
StarBasic I write:

shell ("c:\hallo.exe", 0 , "-c ""xyz abc?status=test&ort=platte c""")

It does not work. The parameters are splitted. What I have tried:
- Use single quotes
- Use escape characters of the Windows 2000 command processor
- Use XSystemShellExecute.execute

It seems, that someone parses the parameter string and drops some elements. If
there is a valid combination, it would be nice to find it in the documentation.
Comment 1 tb 2003-08-22 07:54:06 UTC
Some additional informations:

shell ("c:\hallo.exe", 0 , "-c 'xyz abc?status=test&ort=platte c'")
-> works

shell ("c:\hallo.exe", 0 , "-c 'xyzabc?status=test&ort=plattec'")
-> works not

shell ("c:\hallo.exe", 0 , "-c ' xyzabc?status=test&ort=plattec'")
-> works

So the generic workaround is, if an own application is called:
- use single quotes
- add a space in front of the parameter
- trim the parameter in the application
Comment 2 ooo 2003-08-25 10:27:21 UTC
StarBasic runtime issue -> UDK.
Comment 3 ab 2003-09-01 14:48:07 UTC
-> OOo 2.0
Comment 4 christof.pintaske 2004-06-17 16:56:35 UTC
cp: retargeted to Office-Later due to limited ressources
Comment 5 ab 2005-07-28 10:11:28 UTC
*** Issue 35568 has been marked as a duplicate of this issue. ***
Comment 6 ab 2005-07-28 10:12:57 UTC
==============================================================
Comments from i35568:

create a simple batch at 'c:\abc def' with:
echo %1 %2 > c:\bug.txt
call it with
print shell("'c:\abc def\bug.sh'", 1, "dumy", true)

-> result is 0 which indicates it was run successfull
but the file c:\bug.txt doesn't exist
in so7 this worked correct and the file bug.txt was created

remove the space between c and d and run again
-> result is still 0
in so7 an error was thrown, telling that the command wasn't found



------- Additional comments from ab Fri Oct 15 01:01:13 -0700 2004 -------

AB->TBO: Sorry, but I connot reproduce this at all. I couldn't make your example

    print shell("'c:\abc def\bug.bat'", 1, "dumy", true)

work anywhere. Both SO 8 / src680 m54 (no Basic changes have been done in
m55/m56) and a SO7 PP0 always throw an error. I used bug.bat in Windows, 
because bug.sh did not work at all, also not in VB.

Also VB6 (changing print to msgbox and leaving away the incompatible last two
parameters) is not able to execute:

    MsgBox Shell("'C:\abc def\bug.bat' dummy")

even if C:\abc def\bug.bat exist. But, assuming that "C:\abcdef\bug.bat" exist,

    MsgBox Shell("C:\abcdef\bug.bat dummy")

is executed in the same way by SO 7, SO 8 and VB.

Besides that the Shell command implementation hasn't been changed since SO 7. 
So if you still see a problem, please ask first if anything has changed in the vos 
OProcess class used by Basic to execute a shell command. But I doubt this.



------- Additional comments from ab Fri Oct 15 01:09:21 -0700 2004 -------

Reassignment failed...

Sorry, I didn't see your 7 PP3 reference and you're right, it really worked in 
7 PP3, but only there, not before and not after. As the code is not even com-
patible to VB I doubt that this is worth a OOo 2.0 target. And it's still true: 
The Shell implementation hasn't changed all the time. So only vos::OProcess
may have been changed, but maybe this was a bug in PP3?



------- Additional comments from tbo Tue Oct 19 03:03:18 -0700 2004 -------

<grr> yes, in SO7 final it didn't work either. -> target moved to later.
Typo in batch name, file extension has to be .bat instead of .sh.
-> assigning to vos::OProcess owner



------- Additional comments from obr Tue Oct 19 03:21:39 -0700 2004 -------

obr @ ab: vos::OProcess is deprecated since ages: please use osl::Process instead.

BTW: just checked and the maintainer of osl::Process is TRA :-).

==============================================================
Comment 7 Marcus 2017-05-20 11:29:22 UTC
Reset assigne to the default "issues@openoffice.apache.org".