188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
|
# File 'ext/arg_scanner/arg_scanner.c', line 188
static VALUE init(VALUE self, VALUE pipe_file_path, VALUE buffering,
VALUE project_root_local, VALUE catch_only_every_n_call_local) {
if (pipe_file_path != Qnil) {
pipe_file_path = rb_file_s_expand_path(1, &pipe_file_path); // https://ruby-doc.org/core-2.2.0/File.html#method-c-expand_path
const char *pipe_file_path_c = StringValueCStr(pipe_file_path);
if (!file_exists(pipe_file_path_c)) {
fprintf(stderr, "Specified pipe file: %s doesn't exists\n", pipe_file_path_c);
exit(1);
}
pipe_file = fopen(pipe_file_path_c, "w");
if (pipe_file == NULL) {
fprintf(stderr, "Cannot open pipe file \"%s\" with write access\n", pipe_file_path_c);
exit(1);
}
int buffering_disabled = buffering == Qnil;
if (buffering_disabled) {
setbuf(pipe_file, NULL);
}
}
if (project_root_local != Qnil) {
project_root = strdup(StringValueCStr(project_root_local));
}
if (catch_only_every_n_call_local != Qnil) {
if (sscanf(StringValueCStr(catch_only_every_n_call_local), "%d", &catch_only_every_n_call) != 1) {
fprintf(stderr, "Please specify number in --catch-only-every-N-call arg\n");
exit(1);
}
srand(time(0));
}
return Qnil;
}
|