OS/2, eCS & ArcaOS - Technical > Programming
MeShell and PAUSE in a cmd file
Martin Vieregg:
Meanwhile, I have published a stable beta version of MeShell 0.51 (see Utilities). But there's one problem left where I need your help for brainstorming.
PAUSE is a command which is defined in cmd.exe or 4os2.exe. It does not handle Stdin, but it does also not handle normal VIO keyboard input. I do not understand completely how it works, because a key input into the MeShell original VIO window has no effect. It seems that it is compiled completely internally. And this is a problem for MeShell. In comparison to "MORE", where I programmed an expedient substitute, I have no Idea at the moment how to handle the PAUSE problem. I hope that you have ideas how to handle the problem.
Programming a tiny "pause.exe" does not work because cmd.exe executes "pause" directly without checking the PATH directory list for external programs.
Till now, I found a convenient solution for every problem, and I hope that someone here has an idea how to solve this problem.
Pete:
Hi Martin
Could you not recompile your pause.exe as a DLL file to be imported/called by your app?
Regards
Pete
Martin Vieregg:
--- Quote ---Could you not recompile your pause.exe as a DLL file to be imported/called by your app?
--- End quote ---
The "PAUSE" command is part of cmd.exe, like "copy" or "dir". In opposite e.g. "xcopy" is an external program "xcopy.exe" and if it would not fit my purpose, I could rewrite and replace it.
The 4os2 source code is available, so I could change it, but I hope that I can handle the problem generally with cmd.exe.
A possible solution would be to ask the user how to handle the cmd file and, as an option, to rewrite it and renaming the original to *.cmd-old and replacing the occurences of "pause" to "pause2" and writing a tiny program "pause2". Or executing a temporary cmd file copy. But I hope that there's a better solution.
It would be already helpful if someone can explain why cmd.exe "Pause" does not accept a VIO keystroke. I don't understand what happens here. You can see the behaviour by typing "PAUSE" in MeShell, then make the VIO window visible, press a key and normally the LED should turn to green and the command "Pause" has finally been executed and a new Prompt appears. But MeShell does not do so. The LED rests red, so the keystroke in the VIO window has not been reached cmd.exe.
Martin Vieregg:
It seems that the problem is a FALSE ALARM. In a very early version of MeShell (cmdme 0.1) PAUSE did work already. So it seems that it is a newer bug in MeShell. I have also seen that the current MeShell 0.51 does not handle user input in a commandline program anymore. I have only to compare the old code with the current one to find the bug.
Martin Vieregg:
Meanwhile I have uploaded MeShell 0.52. The PAUSE problem was a new bug. Even 0.50 worked. (See section utilities).
But there's another related problem:
If a program requires user input via stdin in the same line where an output has placed, like
enter the desired directory name and press ENTER:
MeShell does not show the query, because cmd.exe and 4os2.exe only sends output to stdout if the line has been completed with Return. But both programs send an output without ending Return when the old command has been executed and the new prompt is shown.
With the simple attachment stdin/out based program sample, you can test the behaviour in cmd.exe/4os2.exe and MeShell.
--- Code: ---[C:\]test1
Enter an expression: hello
You have entered: hello
[C:\]
--- End code ---
Do we have access to cmd.exe source code?
I want so send the desire to Netlabs for 4os2.exe. Who is responsible for 4os2.exe Netlabs?
Does anyone has an idea how to force cmd.exe/4os2.exe to spit out the characters which are not shown?
Navigation
[0] Message Index
[#] Next page
Go to full version