Re: cd.exe



On 05/04/09 10:30 am, Steven Levine wrote:
In<ylrLl.25483$Db2.15152@edtnps83>, on 05/04/2009
at 01:16 AM, Dave Yeo<dave.r.yeo@xxxxxxxxx> said:

Hi,

Run a script (located at http://fate.multimedia.cx/running.html) that
has a line like (before some OS/2 mods)
"rm -rf $BUILD_PATH&& mkdir $BUILD_PATH&& cd $BUILD_PATH&&
$SOURCE_PATH/configure --disable-debug --enable-gpl --enable-postproc
--enable-avfilter --enable-avfilter-lavf --enable-shared
--enable-swscale --prefix=$BUILD_PATH/install-directory&& make&& make
install",

Actually the --enable-swscale needs to be removed from above as swscale has been depreciated.

Depending on python's implementation of Popen, this should just work and
hopefully will use the value of SHELL to invode the command.

That's what I hoped but it exits within seconds and never does the rm -f $BUILD or anything else.
Quickly looking at the source of Python 2.5.2 it seems to use %COMSPEC% to load a shell (Modules\posixmodule.c)


I needed to change $BUILD_PATH to %BUILD_PATH%, replace mkdir with
mkdir.exe and have now worked around the CD problem by breaking it into
multiple CD commands with no directory separators.

FWIW, I usually find it less work to do what it takes to keep the build
scripts running under a *nix shell. Typically, I have a 4OS2 script that
sets up the build environment and invokes bash. The script translates
slashes in environment variables when it matters.

I tried running it under ash and ksh, didn't seem to make much difference.


I can use ash to run
configure but it fails to build. (k)sh.exe doesn't work for some reason
when invoked from the script though works fine from the command line.
Unluckily stderr and stdout are not displayed.

Which version of python are you running? Paul's or Andrew's.

Paul's newest seems to support most things, We went over some of the failures and he fixed them (same fixes were needed for Mercurial)

My python
setup is not quite up to building fate. It may be missing some modules.
However, I hacked the script to the point where it would attempt to invoke

process = Popen(command, shell=True, stdout=PIPE, stderr=PIPE)

Unfortunately this seems to fail for any command I supply. I'll revisit
this later today.

It works for me if the full path is specified and is not a built in command eg /bin/rm -rf %BUILD %% /bin/mkdir %BUiLD% work. I added some touch commands for debugging and even cd works if there are no path separators. I'm possibly missing some quoting.

Regards,

Steven


Dave
.



Relevant Pages

  • Re: shell scripting
    ... and am assuming an sh-compatible shell here.... ... command 1 options arguments ... To run the script, do: ... then you need to use the full path to execute it: ...
    (comp.unix.questions)
  • Re: shell scripting
    ... and am assuming an sh-compatible shell here.... ... command 1 options arguments ... To run the script, do: ... then you need to use the full path to execute it: ...
    (comp.unix.shell)
  • Re: [ Attn: Randy ] Ad-hoc Parsing?
    ... I can write and compile ... >>programs inside a shell, ... But for me it is essential, that the script ... > internal command), the this script can be executed even if there ...
    (alt.lang.asm)
  • Re: Script to extract portions of text from a text file
    ... > But your example is not comparing the same command. ... it wouldn't be sent to the shell until you press enter). ... >> behaves differently in a script and at the prompt ... While awk does: ...
    (comp.unix.shell)
  • Re: cd.exe
    ... hopefully will use the value of SHELL to invode the command. ... sets up the build environment and invokes bash. ... The script translates ... when invoked from the script though works fine from the command line. ...
    (comp.os.os2.programmer.porting)