[platform] launcher: making vfprintf hook return a number of processed bytes

..., lest JVM drop incomprehensible "Could not write log" message and shut up

GitOrigin-RevId: cfe19e77c127e9b88e53b7f4ec82e1661bc4c6b1
This commit is contained in:
Roman Shevchenko
2024-07-03 14:51:05 +02:00
committed by intellij-monorepo-bot
parent e9054668cb
commit 4cb3f4c389

View File

@@ -47,11 +47,11 @@ extern "C" fn vfprintf_hook(fp: *const c_void, format: *const c_char, args: va_l
None => unsafe { vfprintf(fp, format, args) },
Some(messages) => {
let mut buffer = [0; 4096];
let _ = unsafe { vsnprintf(buffer.as_mut_ptr(), buffer.len(), format, args) };
let len = unsafe { vsnprintf(buffer.as_mut_ptr(), buffer.len(), format, args) };
let message = unsafe { CStr::from_ptr(buffer.as_ptr()) }.to_string_lossy().to_string();
debug!("[JVM] vfprintf_hook: {:?}", message);
messages.push(message);
0 // because nothing was actually printed
len
}
}
}