OS/2, eCS & ArcaOS - Technical > Programming

MeShell problem - start progname inherits stdin/out

(1/2) > >>

Martin Vieregg:
I have realized now why sometimes starting MeShell fails ("cannot create inpipe...") because a named pipe which has to be closed when closing the last instance of MeShell seems to be still occupied.

The problem occurs if a program has been started via start from MeShell:

[C:\] start e

starts the e Editor in an own session. But it seems that this new session inherits stdout and stdin from the calling cmd.exe process, even it is a PM program, and stdout and stdin are redirected named pipes which are generated when starting MeShell. So when leaving MeShell, the pipes are still occupied while the e Editor is running and MeShell cannot be restarted. After closing the e Editor, you can restart again MeShell. Any idea how to omit inheriting stdin/out/err when starting a program in an own session via Cmd.exe?

Dave Yeo:
Is it
--- Code: ---start e
--- End code ---
or
--- Code: ---"start e"
--- End code ---
that causes the redirection? Reading the help,
--- Code: ---help start
--- End code ---
, it seems to make a difference with the quotation marks causing redirection.

Martin Vieregg:
"start e" is not accepted because it it read as a whole word. start "e" makes no difference to start e. I haven't found something about redirection.

I fear that I have to change the pipe name of the new pipe if the default pipe name is occupied, but it won't be a good solution because the internal instance counter (who influences the colors) when running several instances of MeShell has to be increased. MeShell increases the instance number when opening the named pipe fails which contains the instance counter in the filename.

Laurence Pithie:
A program launched using the START command inherits the open file handles of the parent session. The /I parameter to the START command causes the new session to inherit the environment defined by the SET commands in config.sys instead of the CMD.EXE environment of the current session, in which case stdin will point to the keyboard and stdout will point to the monitor and won't be redirected to the pipe.

Martin Vieregg:
Thank you Laurence!

start /I e indeed works fine.

I have implemented a function where MeShell compiles the string before sending it to cmd.exe. When starting an application, MeShell calls DosQueryAppType and if it is a PM program, it changes the call string to
[C:\] start /I mypmprog

But now, the started PM program does not inherited the current directory of cmd.exe anymore. I haven't found a parameter how to enter the current directory. So a call like

START /I e textfile.txt

fails because textfile.txt resides in the current directory an not in C:\. Any idea?


Navigation

[0] Message Index

[#] Next page

Go to full version