> On Aug 11, 2016, at 6:20 PM, Gurkan Erdogdu wrote:
>
> Hi folks
> In my Swift application, I try to open a Word file with Microsoft Word
> application via NSTask.
To add to what Charles said: NSTask is only for running command-line tools or
other non-GUI binaries. Don’t use it to run a GUI
> On Aug 11, 2016, at 5:20 PM, Gurkan Erdogdu wrote:
>
> Hi folks
> In my Swift application, I try to open a Word file with Microsoft Word
> application via NSTask. Here is the code:
> let task = NSTask()
> task.launchPath = bundle!.executablePath
>
> On 26 Jun 2016, at 4:58 PM, Sandor Szatmari
> wrote:
>
> You can either asynchronously monitor the task's output with notifications,
> or I have read about a new API, but never used it,
> -setReadabilityHandler:^(NSFileHandle* file)
>
> Sandor
>
Thanks!
I was able to set a readability
Graham,
> On Jun 26, 2016, at 01:29, Graham Cox wrote:
>
>
>> On 26 Jun 2016, at 3:22 PM, dangerwillrobinsondan...@gmail.com wrote:
>>
>> If it helps, you can think of it as an object oriented wrapped around C
>> system calls that keeps track of PID and all the other bits like stdout and
>>
Graham,
> On Jun 25, 2016, at 23:37, Graham Cox wrote:
>
> HI all,
>
> I am using NSTask to wrap ffmpeg, the video conversion utility.
>
> I am able to invoke ffmpeg alright, but it’s unclear how the argument list
> should be passed through NSTask. I tried making my various arguments into one
> On 26 Jun 2016, at 3:22 PM, dangerwillrobinsondan...@gmail.com wrote:
>
> If it helps, you can think of it as an object oriented wrapped around C
> system calls that keeps track of PID and all the other bits like stdout and
> so on.
> That helps to grok why the args is and array and the too
If it helps, you can think of it as an object oriented wrapped around C system
calls that keeps track of PID and all the other bits like stdout and so on.
That helps to grok why the args is and array and the tool is separate.
Sent from my iPhone
> On Jun 26, 2016, at 1:37 PM, Graham Cox wrot
Ah thanks Marco, Andy… this makes a lot more sense and works fine.
—Graham
> On 26 Jun 2016, at 2:30 PM, Marco S Hyman wrote:
> I believe arguments is an array of arguments, not an array containing a
> string that matches a command line.
>
> Then your arguments array should contain five item
>
> NSString* argString = [NSString stringWithFormat:@"-i \"%@\" -c copy
> %@", [url absoluteString], [self.outputFileURL absoluteString]];
>
> self.ffMPEGTask = [NSTask launchedTaskWithLaunchPath:execPath
> arguments:@[argString]];
I believe arguments is an array of argument
Don't glom the arguments together. Pass each as a separate array
element: "-i", the URL string, "-c", "copy", the output string.
And you don't need to quote the arguments, just pass them as is.
I hope that makes sense -- I'd make it more code-like if I were at my
desk rather than on my phone.
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 02/25/2015 04:15 PM, Kyle Sluder wrote:
> On Wed, Feb 25, 2015, at 01:15 PM, SevenBits wrote:
>> Here’s an example of the session when output is printed (notice
>> the echoing):
>>
>> Insane BF Interactive Console 1.0 (Dec 18 2014, 16:22:05) Curren
On Wed, Feb 25, 2015, at 01:15 PM, SevenBits wrote:
> Here’s an example of the session when output is printed (notice the
> echoing):
>
> Insane BF Interactive Console 1.0 (Dec 18 2014, 16:22:05)
> Current memory size: 3 cells, each 4 bytes
> : ,
> ,
> A
> A
>
> :
> : .
> .
> A
> :
>
> And h
Thanks to everyone for helping !!!
Using setEnvironment made it easily. I was looking for a complicated solution
when the solution was not so difficult.
Le 14 avr. 2014 à 17:59, Colas a écrit :
> Thanks also for the idea of -setEnvironment. I will try.
Unfortunately, it is not working. Gnuplot is complaining.
! Package pgfplots Error: Sorry, the gnuplot-result file ‘myFile.pgf-plot.t
able' could not be found. Maybe you need to enable the shell-escape feature? Fo
r pdflatex, this is '>> pdflatex -shell-escape'. You can also invoke '>> gnuplo
t .g
Bryan,
I am trying to adapt your code to pdflatex. I hope it will work!!!
It seems that putting the option -l at the end was very important.
Do you know why? I have to admit that I put these « -c » and « -l » options
thanks to other answers, but I don’t know what they are doing.
Thanks very muc
Le 14 avr. 2014 à 17:07, Bryan Vines a écrit :
> Hi Colas,
>
> Pico is an interactive text editor. I don’t think NSTask is going to give you
> much opportunity to interact with it. Are you using Pico as an example, or
> are you actually trying to launch Pico?
>
> If you really *are* trying t
Colas,
If my previous code snippet doesn’t work with pdflatex, NSTask has a
-setEnvironment method; it may allow you to set your task’s environment
variables.
—
Bryan Vines
On Apr 14, 2014, at 10:40 AM, Colas wrote:
> My problem is that I want to launch pdflatex with the -shell-escape optio
Colas,
Bash’s -c option expects commands in a string which follows. Therefore, this
will work: I’m using /usr/bin/touch as an example, rather than your example of
pico, which is an interactive text editor.
NSTask * myTask = [[NSTask alloc]init];
NSArray * arguments = @[@"-c", @"/us
> Try putting
>
> /usr/bin/pico /Users/colas/myfile.txt
>
> into separate items in the argument NSArray. I find the man page ambiguous,
> and I lack direct experience, but that may be what bash expects.
>
>
It is not working, unfortunately.
> I can’t guarantee that this will solve the large
On Apr 14, 2014, at 10:08 AM, Colas B wrote:
> Without the quotes, the error is
> Error opening terminal: unknown.
Terminal doesn't just run the shell (which, in turn, runs pico). It provides a
window and a TTY (terminal device) for the processes to use and translates the
I/O to the window. T
On 14 Apr 2014, at 10:08 AM, Colas B wrote:
> OK.
>
> But without the simple quotes, it also fails.
>
> With the quotes, the error is
> /bin/bash: pico /Users/colas/myfile.txt: No such file or directory
> Without the quotes, the error is
> Error opening terminal: unknown.
>
> Thanks!
> Le Lund
OK.
But without the simple quotes, it also fails.
With the quotes, the error is
/bin/bash: pico /Users/colas/myfile.txt: No such file or directory
Without the quotes, the error is
Error opening terminal: unknown.
Thanks!
Le Lundi 14 avril 2014 16h19, Jerry Krinock a écrit :
From documentation
Colas,
Do you want your app to open a Terminal window, in which Pico has opened the
file at /Users/colas/myfile.txt?
If that’s so, I don’t think launching it via NSTask is going to get you
anything.
What is the end result you want to achieve?
—
Bryan Vines
On Apr 14, 2014, at 8:59 AM, Colas B
From documentation of -[NSTask setArguments:] :
"The strings in arguments do not undergo shell expansion, so you do not need to
do special quoting”
I don’t know what they mean by “special”, but anyhow, the ‘ ' you put around
your last argument will be passed to your tool and cause it to fail.
ealize that this approach may
be fragile in environments that you don't control (i.e. end-users). There also
may be other variables needed...
> Envoyé depuis Yahoo Mail pour iPad
>
> From: Keary Suska ;
> To: Colas B ;
> Cc: Cocoa-Dev (Apple) ;
> Subject: Re: NSTask: pro
On Apr 10, 2014, at 4:09 PM, Colas B wrote:
> No, it is "Mach-O 64-bit executable"
Then there is no shell run when you execute it via NSTask.
Really, the correct answer is that pdflatex should not depend on a relative or
hard-coded path for gnuplot. (It's fine of course to use such as a defaul
No, it is "Mach-O 64-bit executable"
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your
On Apr 10, 2014, at 2:34 PM, Colas B wrote:
> I don't specify explicitly a bash when I run my program (with NSTask) : I
> just give the path to the program.
It sounds like the program you’re telling NSTask to run is a shell-script. You
can easily verify that by using the ‘file’ command (or j
I am not an unix-ey guy... I don't specify explicitly a bash when I
run my program (with NSTask) : I just give the path to the program. If I
discover the path to the shell being used, does it mean that what used to be
the path of my NSTask will become an argument?About path and
environment var
On Apr 10, 2014, at 2:52 PM, Colas B wrote:
> Hi,
>
> thanks for your answers !
> Your idea sounds good. What can I do if I want both shells invoked from
> programs and login shells to have the same initialization script? Shall I
> write a new script that runs first ~/.login and then myprogram
On Apr 10, 2014, at 1:52 PM, Colas B wrote:
> Your idea sounds good. What can I do if I want both shells invoked from
> programs and login shells to have the same initialization script?
I think it’s better to make sure your login-shell setup script (.bash_profile
or .login) doesn’t have thing
Hi,
thanks for your answers !
Your idea sounds good. What can I do if I want both shells invoked from
programs and login shells to have the same initialization script? Shall I write
a new script that runs first ~/.login and then myprogram ? Or is there a
simplier way?
In my case, myprogram is
On Apr 10, 2014, at 6:23 AM, Keary Suska wrote:
> This is more likely a shell scripting issue, rather than am NSTask issue,
> unless sandboxing is somehow interfering, and you are obscuring the issue by
> not telling us at least how myprogram is locating myauxprogram. The most
> likely culpri
On Apr 10, 2014, at 6:57 AM, Colas B wrote:
> Dear cocoa-dev,
>
> I want to do with an `NSTask` what I am able to do in the terminal via
>
> $ myprogram myfile.ext
>
> I know that `myprogram` (I don't have any control on this program) launches
> another program `myauxprogram`. Furthermore,
On Mar 7, 2014, at 11:24 PM, Trygve Inda wrote:
> The issue is that the
> time spent launching the tool is vastly more then doing the tool's work...
Are you sure about that??? Just because time is spent in the "launch" method
doesn't prove that. You might want to sample (or spindump) everything
>
> On Mar 7, 2014, at 8:38 PM, Trygve Inda wrote:
>
>> I'd like it to work with md5, ffmpeg and others. These all work fine, but
>> quit after returning their data.
>
> There’s nothing you can do about that, unless those tools allow multiple input
> files to be passed on the command line. Chec
On Mar 7, 2014, at 8:38 PM, Trygve Inda wrote:
> I'd like it to work with md5, ffmpeg and others. These all work fine, but
> quit after returning their data.
There’s nothing you can do about that, unless those tools allow multiple input
files to be passed on the command line. Check their man p
>There is, but, first of all, why does this external tool terminate?
> What is it?
I'd like it to work with md5, ffmpeg and others. These all work fine, but
quit after returning their data.
T.
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.co
On 2014 Mar 07, at 18:04, Trygve Inda wrote:
> My app sometimes needs to call an external tool that runs via NSTask and
> delivers text output back to my app. I profiled it and most of the time
> (30%) is spent in [NSConcreteTask launchWithDictionary]
>
> Is there any technique I can use to kee
> On Nov 27, 2013, at 7:59 AM, koko wrote:
>
> NSString *scriptPath = [[NSBundle mainBundle] pathForResource:@"DeleteHidden"
> ofType:nil];
>
> NSTask *task;
> task = [[NSTask alloc] init];
> [task setLaunchPath:scriptPath];
>
> The script DeleteHidden had line endings of which caused an exc
NSString *scriptPath = [[NSBundle mainBundle] pathForResource:@"DeleteHidden"
ofType:nil];
NSTask *task;
task = [[NSTask alloc] init];
[task setLaunchPath:scriptPath];
The script DeleteHidden had line endings of which caused an exception
on 10.9
removing the via a hex editor resolved the 10.
On Nov 26, 2013, at 9:47 AM, koko wrote:
> NSTask *task;
> task = [[NSTask alloc] init];
> [task setLaunchPath:rootScriptPath];
> [task setArguments:[NSArray arrayWithObjects:rootpath, nil]];
> [task waitUntilExit];
> [task launch];
> [task release];
You have the invocation of -launch and -wai
On Tue, Nov 26, 2013, at 09:37 AM, koko wrote:
>
> On Nov 26, 2013, at 10:26 AM, Kyle Sluder wrote:
>
> > Error 2 is ENOENT. The path you passed to -setLaunchPath: does not exist.
> >
>
>
> Not possible as
>
> [task setLaunchPath:rootScriptPath];
>
> where rootScriptPath is NSString *rootS
So:
NSFileManager *fileMgr = [NSFileManager defaultManager];
NSArray *contents = [fileMgr contentsOfDirectoryAtPath:
error:nil];
for (NSString *item in contents)
{
if ([item rangeOfString:].location !=NSNotFound)
{
[
On Nov 26, 2013, at 9:42 AM, koko wrote:
>
> On Nov 26, 2013, at 8:56 AM, Pax <45rpmli...@googlemail.com> wrote:
>
>> hy would you delete files in this manner?
>
> Need to wildcard the file names.
Get the directory contents and look for matches, or use glob.
--
Scott Ribe
scott_r...@eleva
On Nov 26, 2013, at 8:56 AM, Pax <45rpmli...@googlemail.com> wrote:
> hy would you delete files in this manner?
Need to wildcard the file names.
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator com
Why would you delete files in this manner? It's more efficient to delete them
directly from your Objective C code, thus:
NSArray *fileArray = [@"path1",@"path2"];
for (NSString *filename in fileArray)
{
[fileMgr removeItemAtPath:filename error:NULL];
}
You already know wh
On Tue, Nov 26, 2013, at 07:47 AM, koko wrote:
> This works just fine up to and including 10.8.5 BUT throws an exception
> at [task launch] on 10.9
What is the exception?
--Kyle Sluder
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do
Scott,
Thanks for your detailed message. This lead me to search for -interrupt calls
and I found one on another NSTask. I was assuming that this typesetting task
was the issue, but maybe it's really this other task. My biggest problem is
that I've never managed to reproduce the exception/crash
On Jul 25, 2013, at 8:24 AM, Martin Hewitson wrote:
> Dear list,
>
> I have a couple of users reporting exceptions (and crashes) which I think are
> associated with my interrupting an NSTask when they close a document. I get
> exceptions like this:
>
> *** -[NSConcreteTask interrupt]: task no
On Feb 20, 2013, at 10:31 PM, Kyle Sluder wrote:
> On Feb 20, 2013, at 8:30 PM, Jens Alfke wrote:
>
>> On Feb 20, 2013, at 8:22 PM, Kyle Sluder wrote:
>>
>>> You can accomplish this without writing to the file system, but it
>>> involves foregoing NSTask. Fork, close stdin in the child process
On Feb 20, 2013, at 10:28 PM, Kyle Sluder wrote:
> On Wed, Feb 20, 2013, at 08:22 PM, Kyle Sluder wrote:
>> You can accomplish this without writing to the file system, but it
>> involves foregoing NSTask. Fork, close stdin in the child process, open
>> a pipe (so that the child gets the read end i
Oh crap, NOW I get it. :P You don't have to do the fork dance at all.
Just call -setStandardInput: and pass /dev/stdin as the filename
argument. Let NSTask take care of the rest.
--Kyle Sluder
On Wed, Feb 20, 2013, at 08:30 PM, Jens Alfke wrote:
>
> On Feb 20, 2013, at 8:22 PM, Kyle Sluder wro
On Feb 20, 2013, at 8:30 PM, Jens Alfke wrote:
>
> On Feb 20, 2013, at 8:22 PM, Kyle Sluder wrote:
>
>> You can accomplish this without writing to the file system, but it
>> involves foregoing NSTask. Fork, close stdin in the child process, open
>> a pipe (so that the child gets the read end i
On Feb 20, 2013, at 8:22 PM, Kyle Sluder wrote:
> You can accomplish this without writing to the file system, but it
> involves foregoing NSTask. Fork, close stdin in the child process, open
> a pipe (so that the child gets the read end in fd 0), then exec the tool
> with "/dev/stdin" as the fil
On Wed, Feb 20, 2013, at 08:22 PM, Kyle Sluder wrote:
> You can accomplish this without writing to the file system, but it
> involves foregoing NSTask. Fork, close stdin in the child process, open
> a pipe (so that the child gets the read end in fd 0), then exec the tool
> with "/dev/stdin" as the
On 2013/02/21, at 13:11, Jens Alfke wrote:
>
> On Feb 20, 2013, at 4:18 PM, dangerwillrobinsondan...@gmail.com wrote:
>
>> Is there a way to feed an NSTask argument data when the command line tool in
>> the task expects a file path argument?
>> I would like to not actually create a file to u
On Wed, Feb 20, 2013, at 08:11 PM, Jens Alfke wrote:
> You could conceivably create a fake volume in the filesystem that didn’t
> correspond to any real file but just returned your data when read
> (something like what the disk images driver does) … but the moment you
> did this, your data would ex
On Feb 20, 2013, at 4:18 PM, dangerwillrobinsondan...@gmail.com wrote:
> Is there a way to feed an NSTask argument data when the command line tool in
> the task expects a file path argument?
> I would like to not actually create a file to use as the argument, but rather
> send data that would b
On Feb 21, 2013, at 9:46 AM, Greg Parker wrote:
> On Feb 20, 2013, at 4:18 PM, dangerwillrobinsondan...@gmail.com wrote:
>> Is there a way to feed an NSTask argument data when the command line tool in
>> the task expects a file path argument?
>> I would like to not actually create a file to use
On Feb 20, 2013, at 4:18 PM, dangerwillrobinsondan...@gmail.com wrote:
> Is there a way to feed an NSTask argument data when the command line tool in
> the task expects a file path argument?
> I would like to not actually create a file to use as the argument, but rather
> send data that would be
On Feb 6, 2013, at 10:29 PM, Chris Hanson wrote:
> On Feb 4, 2013, at 11:26 AM, Seth Willits wrote:
>
>> Looking around the open source code for exec(), it appears EINVAL (22) can
>> be returned if the task was exec()'d when not called from a vfork()'d
>> process, with the comment /* If we're
On 2/4/13 8:26 PM, Seth Willits wrote:
[snip]
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 com.apple.Foundation0x978142d8
___NEW_PROCESS_COULD_NOT_BE_EXECD___ + 7
1 com.apple.Foundation0x976d2e16 -[NSConcreteTask
launchWithDictionary:] + 4698
2
On Feb 4, 2013, at 11:26 AM, Seth Willits wrote:
> Looking around the open source code for exec(), it appears EINVAL (22) can be
> returned if the task was exec()'d when not called from a vfork()'d process,
> with the comment /* If we're not in vfork, don't permit a mutithreaded task
> to exec
On Feb 5, 2013, at 10:39 AM, Seth Willits wrote:
>> Does your crash log show multiple threads? I would expect that the crash log
>> shows only one thread because NSTask called fork() already.
>
> Hmm. Yes, there's only one thread. I didn't notice that. That explains the
> crash (of the forked
> Does your crash log show multiple threads? I would expect that the crash log
> shows only one thread because NSTask called fork() already.
Hmm. Yes, there's only one thread. I didn't notice that. That explains the
crash (of the forked process) "instead of an exception," like you mentioned.
>
On Feb 4, 2013, at 11:26 AM, Seth Willits wrote:
> Exception Type: EXC_BREAKPOINT (SIGTRAP)
> Exception Codes: 0x0002, 0x
>
> *** NSTask: Task create for path
> '/Applications/App.app/Contents/Resources/mytask' failed: 22, "Invalid
> argument". Terminating temporary
On Jul 30, 2012, at 8:08 AM, Daniel Stein wrote:
> The tool tries to open the file with an ordinary call to fopen():
> f = fopen("my.data",READ_MODE);
Of course this assumes the current directory is the one containing the my.data
file. By default it won't be, because the tool inherits the curr
Thank you!
That makes lots of sense and I was able to fix my code. I knew that I sometimes
got zero length data, but never knew why. Now that I know it's the end of file…
I can make lots of use of this knowledge.
Thanks for the help.
On Jul 31, 2012, at 11:20 PM, Ken Thomases wrote:
> NSPipe
NSPipe itself doesn't require that a run loop be run, but the
"InBackgroundAndNotify" methods of the associated NSFileHandle objects do.
You receive a zero-length NSData when (and only when) a read encounters EOF.
There is an inherent race between the receipt of the task termination
notificatio
On Jul 31, 2012, at 7:43 PM, Mr. Gecko wrote:
> I need threads because the main thread is a network loop waiting for a
> connection and when it gets a connection, it spawns a thread like in my
> example. I need to be able to respond to the client with all the data from
> the task and I need t
I need threads because the main thread is a network loop waiting for a
connection and when it gets a connection, it spawns a thread like in my
example. I need to be able to respond to the client with all the data from the
task and I need to close out the connection and release the spawned
threa
On Jul 31, 2012, at 6:53 PM, "Mr. Gecko" wrote:
>
> I can confirm if you do not stop the run loop, it will get everything…
> However… I cannot do this as I do not know how much data I am receiving from
> the task.
1) Yes, you need to run the run loop forever (NSDistantFuture).
2) You don't n
I have multiple run loops.
On the main thread I have [[NSRunLoop currentRunLoop] run];
On the sub threads for NSTask and NSPipe, I have
CFRunLoopRunInMode(kCFRunLoopDefaultMode, 1, YES);
If you are saying that you have to use NSRunLoop in order for it to work, get
it working in my example and
On Tue, Jul 31, 2012, at 03:33 PM, Mr. Gecko wrote:
> I am having weird results with NSTask. It sometimes retrieves the output,
> and other times receives nothing.
>
> I have example code for this issue at
> https://dl.dropbox.com/u/610721/NSTask%20Issue.zip
NSTask requires a running runloop. You
What do you recommend after the task finishes? I have tried [[outPipe
fileHandleForReading] readDataToEndOfFile] after the task finishes and it
doesn't seem to improve. Can you maybe give me an example of how to do this
right?
On Jul 31, 2012, at 6:01 PM, Wim Lewis wrote:
> I haven't looked a
On 31 Jul 2012, at 3:33 PM, Mr. Gecko wrote:
> I am having weird results with NSTask. It sometimes retrieves the output, and
> other times receives nothing.
I haven't looked at the code you posted, but is it possible that you're reading
from the NSPipe in such a way that you're mixing up the "e
Re: NSTask terminates when NSApplication exits (Scott Ribe)
Ling Peng
在 2012年1月19日,4:02,cocoa-dev-requ...@lists.apple.com 写道:
> Re: NSTask terminates when NSApplication exits (Scott Ribe)
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Ple
On Jan 19, 2012, at 11:49 AM, Jens Alfke wrote:
> Huh; you learn something new every day!
Yeah, specifically I learned this about 6 months ago ;-)
> In addition to shell behavior you mention, I also see this when Xcode crashes
> and takes down the app I’m debugging. But I suppose Xcode configur
On Jan 19, 2012, at 12:49 PM, Jens Alfke wrote:
> On Jan 19, 2012, at 10:10 AM, Scott Ribe wrote:
>
>> Not true. It looks like the case at a cursory level because session
>> management does this when you're in the terminal. There are various ways to
>> arrange for a process to exit when its par
On Jan 19, 2012, at 10:10 AM, Scott Ribe wrote:
> Not true. It looks like the case at a cursory level because session
> management does this when you're in the terminal. There are various ways to
> arrange for a process to exit when its parent exits. But it is *not* the case
> that a process i
On Jan 18, 2012, at 1:38 PM, Jens Alfke wrote:
>
> Nope. In Unix, a process is killed when its parent process exits.
Not true. It looks like the case at a cursory level because session management
does this when you're in the terminal. There are various ways to arrange for a
process to exit whe
On Jan 18, 2012, at 2:27 PM, Ken Thomases wrote:
> On Jan 18, 2012, at 3:13 PM, Keary Suska wrote:
>
>> Any special handling of NSTask aside, Mac OS X uses Unix-based process
>> control which closes all child processes when the parent is closed.
>
> No, that's not true. Where did you get that
On Wed, Jan 18, 2012 at 12:38 PM, Jens Alfke wrote:
> Nope. In Unix, a process is killed when its parent process exits.
No it's not.
/tmp% cat processes.c
#include
#include
int main(int argc, char **argv)
{
printf("Parent pid is %lu\n", (unsigned long)getpid());
pid_t child = fork();
On Jan 18, 2012, at 10:59 AM, Andrew wrote:
> I am trying to write a program that maintains different installs of
> another program including launching the program. To do so, I am using
> NSTask. Now when I quit my cocoa app. the NSTask app dies. …
> According to what I have read, the applicatio
On Jan 18, 2012, at 2:27 PM, Ken Thomases wrote:
>> Note that you can't do this with Cocoa/Objective-C (at least Apple says you
>> shouldn't…)
>
> You can fork() and exec() just fine. What you can't do is fork(), _not_ call
> exec(), and then do anything other than call POSIX async-cancel-safe
Thanks, I'll have a look.
BTW, I was able to confirm it is a result of streams. My Java
processes do not quit if I pipe their output to null:
NSTask *task = [NSTask new];
[task setLaunchPath:execPath];
[task setCurrentDirectoryPath:_directory];
[task setArguments:arguments];
[task setStandard
On Jan 18, 2012, at 3:13 PM, Keary Suska wrote:
> Any special handling of NSTask aside, Mac OS X uses Unix-based process
> control which closes all child processes when the parent is closed.
No, that's not true. Where did you get that?
Processes with a controlling terminal get a SIGHUP when th
On Jan 18, 2012, at 11:59 AM, Andrew wrote:
> I am trying to write a program that maintains different installs of
> another program including launching the program. To do so, I am using
> NSTask. Now when I quit my cocoa app. the NSTask app dies. The task
> that the NSTask is running is a Java pro
On Jan 18, 2012, at 11:59 AM, Andrew wrote:
> I can probably find out the answer by trying different things, but I'd
> like to get a better insight for what is going on and why the child
> task is terminating.
You may want to try LS (Launch Services) routines.
--
Scott Ribe
scott_r...@eleva
Thanks, that's what I was missing.
Rainer
On Aug 5, 2011, at 20:21, Stephen J. Butler wrote:
> On Fri, Aug 5, 2011 at 10:15 PM, Rainer Standke wrote:
>> args: (
>>"-T fusion",
>>"-gu Administrator",
>>"-gp Admin",
>>runScriptInGuest,
>>"\"/Users/rainer/Documents/Virtual Mac
On Fri, Aug 5, 2011 at 10:15 PM, Rainer Standke wrote:
> args: (
> "-T fusion",
> "-gu Administrator",
> "-gp Admin",
> runScriptInGuest,
> "\"/Users/rainer/Documents/Virtual Machines.localized/Windows XP
> Professional v1.vmwarevm/Windows XP Professional v1.vmx\"",
> "",
> "
On Jul 26, 2011, at 11:22 PM, Scott Ribe wrote:
> On Jul 26, 2011, at 5:52 PM, Shane Stanley wrote:
>
>> In Snow Leopard that worked fine; a notification would be sent when new data
>> was written to the file. In Lion, as soon as it's called it goes into a
>> loop; each time readInBackgroundAndNo
On Jul 26, 2011, at 5:52 PM, Shane Stanley wrote:
>> Maybe you should try to re-open your bug ;-)
>
> I did, but no reply.
Too bad, since it seems to me the person who responded didn't know what they
were talking about.
> In Snow Leopard that worked fine; a notification would be sent when new
On 27/7/11 3:18 AM, "Scott Ribe" wrote:
> Maybe you should try to re-open your bug ;-)
I did, but no reply.
Here's some code that's reading a file that's being written periodically:
-(void)dataFromFile:(NSNotification *)notif {
NSData *data = [[notif userInfo]
objectForKey:NSFileHandleNoti
On Jul 26, 2011, at 12:18 AM, Shane Stanley wrote:
>> On Jul 25, 2011, at 3:40 AM, Shane Stanley wrote:
>>
I wonder if they've changed how the readInBackgroundAndNotify works.
>>>
>>> Yes, they have. I logged a bug on it, and was told that the way it worked in
>>> 10.6 was wrong -- whereas
On 26/7/11 1:14 AM, "Scott Ribe" wrote:
> On Jul 25, 2011, at 3:40 AM, Shane Stanley wrote:
>
>>> I wonder if they've changed how the readInBackgroundAndNotify works.
>>
>> Yes, they have. I logged a bug on it, and was told that the way it worked in
>> 10.6 was wrong -- whereas it used not to s
On Jul 25, 2011, at 3:40 AM, Shane Stanley wrote:
>> I wonder if they've changed how the readInBackgroundAndNotify works.
>
> Yes, they have. I logged a bug on it, and was told that the way it worked in
> 10.6 was wrong -- whereas it used not to send a notification until there was
> something to
On Jul 24, 2011, at 11:01 PM, Stephen J. Butler wrote:
> That is, abandon processPipeClose and let each pipe handle its own
> close in the notification when you're sure all of its read
> notifications have actually been delivered. As you've presented it,
> processPipeClose isn't needed.
Your theo
On 25/7/11 3:01 PM, "Stephen J. Butler" wrote:
> I wonder if they've changed how the readInBackgroundAndNotify works.
Yes, they have. I logged a bug on it, and was told that the way it worked in
10.6 was wrong -- whereas it used not to send a notification until there was
something to read, it no
1 - 100 of 308 matches
Mail list logo