Tag: nstask

使用NSTask来执行离子build立命令 – 启动path不可访问

我正在与具有命令行界面的Ionic合作。 我想创build一个小的Mac应用程序,帮助执行某些命令。 在terminal我cd Users/me/Desktop/Repos/ionic-project/myApp改变后,我会例如ionic run NSTask *task = [[NSTask alloc]init]; task.launchPath = @"/bin/bash"; task.currentDirectoryPath = @"cd Users/me/Desktop/Repos/ionic-tryouts/myApp"; task.arguments = @[@"ionic run"]; [task launch]; 但是这给了我“工作目录不存在”。 我在这里已经阅读了相当多的线索。 我的错误是什么? 编辑: 感谢Christik的详细解答。 我现在有这样的代码: NSTask *task = [[NSTask alloc]init]; task.launchPath = @"/usr/local/bin/ionic"; task.currentDirectoryPath = @"/Users/me/ionic-tryouts/myApp"; task.arguments = @[@"run"]; [task launch]; 现在我得到以下错误:env:node: No such file or directory 。 我想这是来自一个问题,node.js没有find(离子build立在节点的顶部)。 我发现这个问题 – […]