I wanted to pipe a process output into the input of another and not show anything in stdout, but I don't really get how I should do it. I managed to make a pipe and start the processes but I can't get stdout to be quiet:
package example
import "core:fmt"
import "core:os/os2"
main :: proc()
{
openssl_command := []string{"openssl", "s_client", "-quiet", "-connect", "github.com:443", "-servername", "github.com"}
curl_command := []string{"curl", "-L", "-s", "-o", "odin-logo.png", "https://github.com/odin-lang/Odin/blob/master/misc/logo-slim.png"}
readPipe, writePipe, err := os2.pipe()
fmt.assertf(err == nil, "Could not create pipe: %v", err)
curl_desc := os2.Process_Desc { command = curl_command, stdin = readPipe }
openssl_desc := os2.Process_Desc { command = openssl_command, stdout = writePipe }
curl_process, openssl_process: os2.Process
state: os2.Process_State
openssl_process, err = os2.process_start(openssl_desc)
fmt.assertf(err == nil, "Could not start openssl process: %v", err)
state, err = os2.process_wait(openssl_process)
fmt.assertf(err == nil, "Could not wait for openssl process: %v", err)
err = os2.process_close(openssl_process)
fmt.assertf(err == nil, "Could not close openssl process: %v", err)
os2.close(writePipe)
curl_process, err = os2.process_start(curl_desc)
fmt.assertf(err == nil, "Could not start curl process: %v", err)
state, err = os2.process_wait(curl_process)
fmt.assertf(err == nil, "Could not wait for curl process: %v", err)
err = os2.process_close(curl_process)
fmt.assertf(err == nil, "Could not close curl process: %v", err)
os2.close(readPipe)
}
The problem is, curl has the '-s' flag to specify quiet output but I can't get openssl to be quiet even with the '-quiet' flag 😭
PS: This isn't the website I actually want to download from, I just put it as a placeholder