NSTask and wildcard problem ?
27/08/05 21:56
Why launching a NSTask with parameters including some wildcards doesnt' work, while the same command in Terminal.app works perfectly ?
This is because wild card expansion is done by the running shell.
When launching a process with NSTask, there is no running shell (unless the process itself is a shell…).
If you want to launch e.g. grep (a classical one used with wild cards…) you have to make the command executed by a shell:
/bin/sh -c grep ...
so the NSTask parameters are
@"/bin/sh"
for the launch path and
[NSArray arrayWithObjects:@"-c",@"grep ...",nil];
for the parameters.
When launching a process with NSTask, there is no running shell (unless the process itself is a shell…).
If you want to launch e.g. grep (a classical one used with wild cards…) you have to make the command executed by a shell:
/bin/sh -c grep ...
so the NSTask parameters are
@"/bin/sh"
for the launch path and
[NSArray arrayWithObjects:@"-c",@"grep ...",nil];
for the parameters.