How to set current directory for OSProcess?
David T. Lewis
lewis at mail.msen.com
Sat Oct 28 13:32:08 UTC 2006
On Fri, Oct 27, 2006 at 01:07:25PM +0100, Simon Guest wrote:
> Background: I'm trying to call LaTeX from Squeak using OSProcess, so I
> can have nicely formatted maths formulae, using LaTeX preview mode and
> Ghostscript to generate PNG files from the PDF that LaTeX produces.
>
> But I'm stuck trying to invoke a command such as pdflatex.exe from
> Squeak in a directory of my choosing.
>
> So, having created a temporary directory, how do I run my command in a
> sub-process with that as the current directory?
Simon,
If you are using a Unix/Linux/OS X machine, one way to do this sort
of thing is with a CommandShell script:
cs := CommandShell new open; yourself.
cs script:
'echo change directory to /tmp
cd /tmp
pwd
echo do some LaTeX stuff here
echo you can use pipelines also | cat
sleep 4
/usr/bin/noSuchCommand
exit'
onFailureDo: [:p |
cs command: 'exit'.
'the command that failed was ', p printString]
You don't actually need to open the CommandShell window, but it helps
to do so while you are debugging your scripts.
Dave
More information about the Squeak-dev
mailing list
|