[comp.sys.next] system calls from objective-C

archmage@Cs.McGill.Ca@cs.mcgill.ca (Patrick Marcoux) (06/15/91)

Hi,

	I'm trying to code an application that, at some point, starts up
a program in background.

To do this, I tried to use the standard C system() call. For
some reason, (I have a few guesses, but i'm not sure why)
it runs fine when I start the app from Stuart (the vt-100 terminal
I usualy use).

But, when I start the app by clicking it's icon, it doesn't execute
the background program.

If anyone has a way around this, either by using an NX function or
by sending some message to the Workspace Manager, (or anything)
please let me know.


Thanks,
  The Mage.


PS: I'm in sort of a time crunch, as this is my last bug, and this
thing is due tomorow. Speedy responces would be greatly appreciated.
 
-- 
============================================================================

	"When things are blackest, I just tell myself
	`cheer up, things could be worse!'  And sure

dennisg@kgw1.xetron.COM (Dennis Glatting) (06/21/91)

the problem may be the application search path.  the search path used
by an application clicked via an icon is different then the search path
you defined in your shell.  there is a default which you can alter
to modify the default search path.

-- 
 ..!uunet!kgw2!dennisg  | Dennis P. Glatting
 dennisg@Xetron.COM     | so?

scott@mcs-server.gac.edu (Scott Hess) (06/22/91)

In article <2192@kgw2.XETRON.COM> dennisg@kgw1.xetron.COM (Dennis Glatting) writes:
   the problem may be the application search path.  the search path used
   by an application clicked via an icon is different then the search path
   you defined in your shell.  there is a default which you can alter
   to modify the default search path.

Sheesh, thanks!  Here, I was looking for obscure causes for the problem,
when this is a more likely excuse.  I plead that I thought that was
too obvious.

This could bring in a whole slew of related circumstances.  For
instance, system(3) should use your default shell, so the ~/.cshrc
(or ~/.profile) should be sourced.  _But_, if you change the path
in ~/.login for csh, that will change things.

In the future, when people have problems similar to this, be sure
to post a full list of symptoms.  Obvious ones for this:

The program you are trying to run.
Whether it works when fully-specified (ie, /bin/date, instead of
	date).
If it's not a standard program, whether it's interactive or not.
[And I'm sure there's a couple more obvious ones I'm missing]

[Why am I posting this to the net?  Because, I've gotten a couple
 messages from people with similar problems lately, almost always
 saying "my program doesn't work when run from Workspace.  Why
 not?"  I can't operate from that set of data . . .]

Later,
--
scott hess                      scott@gac.edu
Independent NeXT Developer	Graduated GAC Undergrad!
<I still speak for nobody>
Note:  I have moved home for a time.  My email address will still be
valid.  Any SnailMail should be redirected, along with phone calls.
At the least, my parents can tell you how to get hold of me, or
forward any mail . . .
Old:	PO 829, GAC, St. Peter, MN  56082	(507) 933-8466
New:	RR#4 Box 227 Pipestone, MN  56164	(507) 825-2788

louie@sayshell.umd.edu (Louis A. Mamakos) (06/23/91)

In article <SCOTT.91Jun21214058@mcs-server.gac.edu> scott@mcs-server.gac.edu (Scott Hess) writes:
>In article <2192@kgw2.XETRON.COM> dennisg@kgw1.xetron.COM (Dennis Glatting) writes:
>
>This could bring in a whole slew of related circumstances.  For
>instance, system(3) should use your default shell, so the ~/.cshrc
>(or ~/.profile) should be sourced.

Please! No! No!  Not that!  There is a reason that system and 'make'
use the Bourne shell: to get predictable behavor.  For instance,
suppose that I want to invoke a program with the system(3) library
routine, and I want to redirect its standard output AND standard error
into a file.  How do I do this?  From the Bourne shell, I'd do
something like this:

	/foo/bar/my/program > output 2>1

but from the C-shell, I'd do this instead:

	/foo/bar/my/program >& output

How am I, the application writer that wants to use the system routine
supposed to know what to use?  I suppose that I could look at the
environment variable, but then I'd have to know how each and every
weird shell that exists is supposed to work, which meta-characters do
what, and who knows what else!

Right now I *know* for certain that the Bourne Shell is being invoked
to do this stuff, and can write code accordingly.

louie

isbell@ucscf.UCSC.EDU (Art Isbell) (06/23/91)

In article <1991Jun22.214905.24958@ni.umd.edu> louie@sayshell.umd.edu (Louis A. Mamakos) writes:
>routine, and I want to redirect its standard output AND standard error
>into a file.  How do I do this?  From the Bourne shell, I'd do
>something like this:
>
>	/foo/bar/my/program > output 2>1
                                 ^^^
Just so nobody is confused by this typo, an '&' was omitted: 2>&1
-- 
                                          _____   ____
Art Isbell                 |\   |  HELP!  |    |  |   \    315 Moon Meadow Lane
NeXT Registered Developer  | \  |   ___   |____|  |    |  Felton, CA 95018-9442
isbell@ucscf.UCSC.EDU      |  \ |  |___|  |  \    |    |          (408)335-1154
=> I NEED TO FIND NeXT ==> |   \|  |___   |   \   |___/ ==> DEVELOPMENT WORK <=