delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/02/22/11:31:09

X-Spam-Check-By: sourceware.org
Date: Thu, 22 Feb 2007 11:30:39 -0500 (EST)
From: Igor Peshansky <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: moka AT hol DOT gr
cc: cygwin AT cygwin DOT com
Subject: Re: gracebat runs in X, but not as a system call from a perl script
In-Reply-To: <1172127807.45dd403f54ad1@easymail-old.hol.gr>
Message-ID: <Pine.GSO.4.63.0702221120420.6005@access1.cims.nyu.edu>
References: <1172047813 DOT 45dc07c528fc4 AT easymail-old DOT hol DOT gr> <Pine DOT GSO DOT 4 DOT 63 DOT 0702211138540 DOT 13824 AT access1 DOT cims DOT nyu DOT edu> <1172127807 DOT 45dd403f54ad1 AT easymail-old DOT hol DOT gr>
MIME-Version: 1.0
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Ugh, top-posting...  Reformatted.

On Thu, 22 Feb 2007, moka wrote:

> > On Wed, 21 Feb 2007, moka wrote:
> >
> > > I do startxwin to open X and  then do
> > > gracebat <parameters>
> > > this does what I want, namely produce a jpeg file
> > >
> > > Now if I try this for a perl script(run from X)
> > > system(gracebat <parameters>)
> > >
> > > i.e. the exact same line that produced the right result
> > > I get an error.
> > >
> > > I guess the reason is that I am using the activestate perl instead of the
> > > cygwin
> > >  perl; anyway there were reasons for that, not sure if valid or not[the
> > reason
> > >  was getting DBD::Oracle to work, which was a huge pain].
> > > So I guess "system" to perl is whatever system Activestate was installed
> > for,
> > > i.e. Windows.
> > >  The question is:
> > > Is it possible to get around this?
> > > Can I tweak the system command so that it executes  gracebat(but
> > >  otherwise use Activestate, e.g.  for Oracle DBI queries?
> >
> > As the package list shows (I don't have grace installed), gracebat is a
> > symlink.  A Windows program like ActiveState Perl will not understand
> > Cygwin's symlinks (nor will it run a shell script, since it uses cmd as
> > its shell).  The easiest thing you can do is invoke a Cygwin shell (bash,
> > sh, pdksh, etc) and let it run the command.  That way, no matter what the
> > command is (an executable, or a symlink, or a shell script), the shell
> > will interpret it for you and invoke it properly.
> >
> > Be careful with quoting -- you may want to use the list form of
> > system()...
> > 	Igor
>
> Note sure I understand what the bash solution is:
>  I do startxwin to open an X-session, then I do
>  bash
> and then run
> perl myscript.pl
> This stumbles on the same problem
>
> So if I understand you correctly, replacing "gracebat"
> by "C:\path_to_gracebat.exe\gracebat"(which cmd.exe would presumably
> understand) would work?

No, because it's not a path issue.  It finds c:\cygwin\bin\gracebat.exe
all right, but ActiveState Perl uses cmd as its shell for the system()
call, and gracebat.exe is a symlink, which cmd doesn't understand.  You
need to invoke a Cygwin shell to interpret the symlink.

You should replace the system() call by something like

system("c:/cygwin/bin/$shell","-c",
       "exec /bin/gracebat \"\$\@\"","/bin/gracebat",@gracebat_args);

where $shell is any of "sh.exe", "bash.exe", "pdksh.exe", "zsh.exe", etc.

Your approach for invoking xmgrace.exe directly didn't work because the
executable actually checks the name it's invoked under, so you needed to
add extra arguments to xmgrace to make it behave like gracebat (if it's
possible -- I never worked with grace, so I don't know).
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_	    pechtcha AT cs DOT nyu DOT edu | igor AT watson DOT ibm DOT com
ZZZzz /,`.-'`'    -.  ;-;;,_		Igor Peshansky, Ph.D. (name changed!)
     |,4-  ) )-,_. ,\ (  `'-'		old name: Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

Freedom is just another word for "nothing left to lose"...  -- Janis Joplin

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019