Your program code will only output “Hello World” once at boot. It can very well be that PlatformIO only connects to the created serialport after it has already output the text. To make a fair comparison, you should at least print the text continously.
while(1) {
printf("Hello, world!\n");
vTaskDelay(1000 / portTICK_PERIOD_MS);
}