Discussion of Common Lisp
-
yhmmc
- Posts: 3
- Joined: Tue Feb 01, 2011 2:03 pm
Post
by yhmmc » Tue Feb 01, 2011 2:09 pm
In Lispworks, here is what I need to do:
call and run an *.EXE program from windowsxp within a running lisp program. (the easy part, I think.)
Go back to the same place I called the program from in Lisp when the EXE file has been closed or quit.
I realize that this is a pretty hard question to answer, but none the less I would appreciate it.
Thanks,
Mel

-
nuntius
- Posts: 538
- Joined: Sat Aug 09, 2008 10:44 am
- Location: Newton, MA
Post
by nuntius » Tue Feb 01, 2011 9:17 pm
I'm not a regular lispworks user; but the trivial-shell portability library contains the following code which may help.
Code: Select all
(system:call-system-showing-output
command
:prefix ""
:show-cmd nil
:output-stream output)
and here's an example somebody posted to stackoverflow.
Code: Select all
(sys:call-system-showing-output "ls -l" :prefix "" :show-cmd nil)
You might find more info in
the LW manual. It looks like there are also call-system and run-shell-command.
-
yhmmc
- Posts: 3
- Joined: Tue Feb 01, 2011 2:03 pm
Post
by yhmmc » Fri Feb 04, 2011 10:49 am
It is not the running part I am after. I am really after the stopping part. And, going back where it was called from.
-
nuntius
- Posts: 538
- Joined: Sat Aug 09, 2008 10:44 am
- Location: Newton, MA
Post
by nuntius » Fri Feb 04, 2011 8:54 pm
When the program quits, you should get an exit code. The lisp code would then continue running from where it started the other program, no?
I don't understand your question.
-
yhmmc
- Posts: 3
- Joined: Tue Feb 01, 2011 2:03 pm
Post
by yhmmc » Mon Feb 07, 2011 6:06 pm
that is what I have been needing. An Exit code. How do I get one?
I simply want to call a windows program like a subroutine would be called in basic or c. I just need to go back where it came from after the windows program stops.
Example. I am on my robot in Lisp. I call a chat.exe program from the c: directory when I am in Lisp.
It runs the chat program in windows called from Lisp. When I am finished with the chatbot, I say Exit. A subroutine would have a "Return" at this point, but this is Lisp. No return.
Instead of just leaving me there in windows, I want it to go back from where it was called in Lisp and keep operating the robot.
does this make sense???
Thanks!!
-
nuntius
- Posts: 538
- Joined: Sat Aug 09, 2008 10:44 am
- Location: Newton, MA
Post
by nuntius » Mon Feb 07, 2011 8:26 pm
Try
call-system. Pass ":wait t" in the parameters. It will block until the program exits. The value returned will be the exit code.
Just give it a try in the REPL.