Page 1 of 1

Question about Lispworks

Posted: Tue Feb 01, 2011 2:09 pm
by yhmmc
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
:)

Re: Question about Lispworks

Posted: Tue Feb 01, 2011 9:17 pm
by nuntius
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.

Re: Question about Lispworks

Posted: Fri Feb 04, 2011 10:49 am
by yhmmc
It is not the running part I am after. I am really after the stopping part. And, going back where it was called from.

Re: Question about Lispworks

Posted: Fri Feb 04, 2011 8:54 pm
by nuntius
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.

Re: Question about Lispworks

Posted: Mon Feb 07, 2011 6:06 pm
by yhmmc
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!!

Re: Question about Lispworks

Posted: Mon Feb 07, 2011 8:26 pm
by nuntius
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.