Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Trouble with scp and NSTask

Trouble with scp and NSTask
Thread Tools
Junior Member
Join Date: Oct 2001
Status: Offline
Reply With Quote
Apr 20, 2003, 02:35 AM
 
I am having trouble using scp with NSTask. Only the standard error is sent to my filehandle. I have tried other commands with the code:

Code:
//create task if (openpty(&master, &slave, devname, NULL, NULL) == -1) { [NSException raise:@"OpenPtyErrorException" format:@"%s", strerror(errno)]; } slaveHandle = [[NSFileHandle alloc] initWithFileDescriptor: slave]; //slave masterHandle = [[NSFileHandle alloc] initWithFileDescriptor: master closeOnDealloc:YES];//master [scp setStandardOutput: slaveHandle]; [scp setStandardError: slaveHandle]; [scp setStandardInput: slaveHandle]; [scp setArguments:[NSArray arrayWithObjects: @"-v", filename,@"user@192.168.1.2:Public", nil]]; [scp setLaunchPath: @"/usr/bin/scp"]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(readSCP:) name: NSFileHandleReadCompletionNotification object: masterHandle]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(endSCP:) name: NSTaskDidTerminateNotification object: scp ]; [masterHandle readInBackgroundAndNotify]; [scp launch];
which work. Has anybody run into this problem or see in error in my code. Any help will be appreciated.

type R
I be that insane n***a from the psycho ward.
     
Junior Member
Join Date: Oct 2001
Status: Offline
Reply With Quote
Apr 22, 2003, 01:24 PM
 
I have figured out that ssh uses ttyp0 for stdin/stdout. But I don't have permission to access that terminal. Has anyone had experience forcing the output by other means or a way of getting around the permissions?

thanks,

type R
I be that insane n***a from the psycho ward.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 03:25 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2