OS/2, eCS & ArcaOS - Technical > Programming
MeShell problem - start progname inherits stdin/out
Pete:
Hi Martin
Probably the easiest way would be to add the Drive:\Path to the filename ie
START /I e Drive:\Path\textfile.txt
Regards
Pete
Martin Vieregg:
Yes, it is an option. But it gets more difficult if there are several parameters. I can compare all parameters with the filenames in the current directory and automatically expand the filenames.
Another option would be to start the app directly from the editor and to send a remark to cmd.exe:
rem e textfile.txt (started via MeShell)
Then, renaming the pipe when failing is still an option. I realized now: Because cmd.exe stdin does not fail (only stdout and sterr is inherited), it will be possible to find out whether the pipe is occupied by a started and still running app or by another MeShell instance.
So I have three options to solve the problem.
Laurence Pithie:
--- Quote ---fails because textfile.txt resides in the current directory an not in C:\. Any idea?
--- End quote ---
Before you issue the start command call DosQueryPathInfo on the filename, passing FIL_QUERYFULLNAME as the second parameter. The fully qualified path name to the file will be in the buffer you pass as the third parameter You can get the buffer size for the returned full path name from DosQuerySysInfo using the QSV_MAX_PATH_LENGTH as the iStart and iLast parameter.
You'll need to parse the command line to ignore command line parameters and arguments to command line parameters, and deal with cases where more than one filename is passed on the command line.
Martin Vieregg:
I have chosen now renaming the pipe if the old pipe is still occupied. It was quite complicated, because I already need to count the pipes for several instances of MeShell. I could choose this option because I have the luck that when starting a PM app from cmd.exe, the inpipe is not inherited (because a PM program cannot read keyboard input from an inpipe, but it could create stdout and stderr output). The instances are counted Pipe1, ...Pipe2, Pipe3 for the inpipe and the first free pipe is the instance number which influences colors and default directories. The stdout and stderr pipes ends with A1, A2... If PipeA1 fails for stdout and stderr because it is still occupied from the started PM program, PipeB1 is tried and so on.
It works fine already. So now I have no restrictions at all when starting a PM application and it gets the current directory by default.
Navigation
[0] Message Index
[*] Previous page
Go to full version