我想创建一个应用程序来启动特定文件夹上的sass watch,我的dubt是如何集成终端调用的:
sass --watch /MyPath/to/scss
进入OSX应用程序?
我尝试过使用NSTask但没有结果...... 使用此代码,我得到“启动路径无法访问”
NSTask *task;
task = [[NSTask alloc] init];
[task setLaunchPath: @"/bin/sass"];
NSArray *arguments;
arguments = [NSArray arrayWithObjects: @"--watch",@"path/to/folder", nil];
[task setArguments: arguments];
NSPipe *pipe;
pipe = [NSPipe pipe];
[task setStandardOutput: pipe];
NSFileHandle *file;
file = [pipe fileHandleForReading];
[task launch];
NSData *data;
data = [file readDataToEndOfFile];
NSString *string;
string = [[NSString alloc] initWithData: data
encoding: NSUTF8StringEncoding];
NSLog (@"%@", string);