Skip to content

Commit ccc377e

Browse files
committed
Log cuda build command to stderr
See #19
1 parent 68f5622 commit ccc377e

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

llamafile/cuda.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,31 @@ static bool CreateTempPath(const char *path, char tmp[static PATH_MAX]) {
131131
}
132132
}
133133

134+
static void LogCommand(char *args[]) {
135+
for (int i = 0; args[i]; ++i) {
136+
if (i) {
137+
tinyprint(2, " ", NULL);
138+
}
139+
// this quoting should be close enough to correct to be
140+
// copy/pastable on both unix and windows command terms
141+
bool need_quotes = !!strchr(args[i], ' ');
142+
if (need_quotes) {
143+
tinyprint(2, "\"", NULL);
144+
}
145+
tinyprint(2, args[i], NULL);
146+
if (need_quotes) {
147+
tinyprint(2, "\"", NULL);
148+
}
149+
}
150+
tinyprint(2, "\n", NULL);
151+
}
152+
134153
static bool Compile(const char *src,
135154
const char *tmp,
136155
const char *out,
137156
char *args[]) {
138157
int pid, ws;
158+
LogCommand(args);
139159
errno_t err = posix_spawnp(&pid, args[0], NULL, NULL, args, environ);
140160
if (err) {
141161
perror(args[0]);

0 commit comments

Comments
 (0)