Skip to content

Commit

Permalink
As a convenience, the system operator concatenates its arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
timburks committed Jun 10, 2012
1 parent 8226890 commit 806d8f6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion objc/Nu.m
Original file line number Diff line number Diff line change
Expand Up @@ -8676,7 +8676,12 @@ @interface Nu_system_operator : NuOperator {}
@implementation Nu_system_operator
- (id) callWithArguments:(id)cdr context:(NSMutableDictionary *)context
{
id command = [[cdr car] evalWithContext:context];
id cursor = cdr;
NSMutableString *command = [NSMutableString string];
while (cursor && (cursor != [NSNull null])) {
[command appendString:[[[cursor car] evalWithContext:context] stringValue]];
cursor = [cursor cdr];
}
const char *commandString = [[command stringValue] cStringUsingEncoding:NSUTF8StringEncoding];
int result = system(commandString) >> 8; // this needs an explanation
return [NSNumber numberWithInt:result];
Expand Down

0 comments on commit 806d8f6

Please sign in to comment.