You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was going through the ffmpeg docs and found a way to create a log file by setting an env variable FFREPORT. Initially, I couldn't find any doc on how to set a command specific environment variable in golang(This is important for me because I run multiple ffmpeg commands inside the program and want different env vars for them). Then, I found this SO answer and tried it out.
What did you expect to see?
The env variable FFREPORT being recognised and used by the ffmpeg command.
What did you see instead?
It didn't look like the env var was being read.
The command ran fine, but it didn't look like ffmpeg recognized the env var FFREPORT I set. So, I tried to run a simple shell script to check if it was working fine and I found this. The env vars set before calling the Cmd.Start aren't actually present (or accessible) to the command being run.
Reproduce the issue
You can easily reproduce this issue with a simple shell script:
We set 2 env vars, KEY1 and KEY2 in the go program and ideally, you should see the output:
val1
val2
// then, all the env vars
But instead, the output you will see will be 2 empty lines and then all the env vars. And you won't find those 2 env vars set from the program in them anywhere.
The text was updated successfully, but these errors were encountered:
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I was going through the ffmpeg docs and found a way to create a log file by setting an env variable
FFREPORT
. Initially, I couldn't find any doc on how to set a command specific environment variable in golang(This is important for me because I run multiple ffmpeg commands inside the program and want different env vars for them). Then, I found this SO answer and tried it out.What did you expect to see?
The env variable
FFREPORT
being recognised and used by the ffmpeg command.What did you see instead?
It didn't look like the env var was being read.
The command ran fine, but it didn't look like ffmpeg recognized the env var
FFREPORT
I set. So, I tried to run a simple shell script to check if it was working fine and I found this. The env vars set before calling theCmd.Start
aren't actually present (or accessible) to the command being run.Reproduce the issue
You can easily reproduce this issue with a simple shell script:
Now, try running this sh script from this go program on playground locally.
We set 2 env vars,
KEY1
andKEY2
in the go program and ideally, you should see the output:But instead, the output you will see will be 2 empty lines and then all the env vars. And you won't find those 2 env vars set from the program in them anywhere.
The text was updated successfully, but these errors were encountered: